Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all 8245 articles
Browse latest View live

nrabon on "I have been Hacked need help please!!"

$
0
0

Hello, I think our website has been hacked. There are links popping up to different websites that has nothing to do with our organization and a few are very inappropriate. Please, how can we get these links off our site and ensure that this does not happen again if someone could get back to me as soon as possible.

Regards,
Tassie


muydelpalo on "fullscreen image slider"

$
0
0

Hi!
I'm trying to build a website with an image slider that fits the whole screen, except for 60px on the bottom where there is a fixed footer with a white background that contains the navigation.

So far, I've tried several plugins but all I can get is images that fit the screen width with auto height, so the footer has never the same fixed height. I'd like the images to behave like the ones on this site
https://biomega.com
(only mine has the footer)

How can I achieve this. I am currently using master slider, but no luck.

Maybe I should build my own gallery slider, but I haven't found much documentation on the subject...

Thanks in advance!

pierrepierrepierre on "Navigation link and pre_get_post"

$
0
0

Hi all,
I'm working on a website where I need to display also future posts (for an event custom post type).
I managed to display it the way I want and make a nice calendar.

But then, on the single view of each event (using single.php), the navigation links only directs to published event and not future ones.

My former pre_get_posts function is

function future_posts( $query ) {

if( !is_admin() && $query->is_main_query() ) {
		$query->set('post_status', array( 'publish','future' ));
	}
}
 add_action( 'pre_get_posts', 'future_posts' );

I tried to add a line to change the query on single page :

if (is_single() ) {
		$query->set('post_status', array( 'publish','future' ));
	}

and i also tried to add the line without conditional tags "is_single()", but it didn't change anything.

Thanks for your help!

pierre

allm on "time of RSS items"

$
0
0

I have read that WordPress, for old times sake, keeps everything running on the UTC timezone, in spite of what you specifiy in the settings.

Using the SimplePie code that is in core, fetching an RSS feed using fetch_feed(), the $item->get_date('G:i') function comes up with the wrong time.

Frustrating as that maybe, I found out that starting with:

$timezone = date_default_timezone_get();
date_default_timezone_set('my time zone code');

and finishing with this:

date_default_timezone_set($timezone);

Gives the correct result.

I am not sure if this has any side effects, or if this is the right way to go about it.

Are there any plans to change things in such a way that everything works OK, without hacks like this? It is totally unexpected behaviour.

Can anyone shed some light on this?

Thanks in advance!

Chaitanya Kulkarni on "custom posts categories templates"

$
0
0

I have created custom post type called as "shops". Under this type I have categories like computer shops, cellphone shops, cloths shops etc.
I want to show this categories on a static page.
How can I show them on a page?

ww3595 on "Administrator's Mode Issue"

$
0
0

I think I have been hacked. Why do I think this? The website functions just fine. However, when I login as the administrator, I can not make changes to the any portion of the theme. As a matter of fact under "Appearances" it has two "Background" selections rather than "Theme Options" and "Background". I have deleted and reloaded WordPress, the Theme and all plugins.

The website is:

So is it in an MySQL table or a PHP file or both?

JakeCr8Guru on "Adding JS to child theme"

$
0
0

Hey everyone.

I have been searching the internet trying to find a solution but have not yet.

I will try to provide as much information with out being confusing.

Here is my website I am trying to make changes to:JakeCreative.Guru

I am using this theme: Responsive Mobile

What I am trying to achieve is to have the main navigation to be sticky and ease to certain section of the page. I am try to use some jQuery plugins or code (files are in my child theme directory).

I am having the JS files called but I am getting errors.
Uncaught TypeError: $ is not a function
Uncaught TypeError: jQuery(...).sticky is not a function

I think it has to do with having jQuery called more than once. If so I have not found how to solve that issue. If you know how that would be great information.

Here is the code I am using. It is placed in my child theme's footer.php file:

...
<!-- Script for sticky.js -->
<script>
	jQuery(document).ready(function(){
	  jQuery("#main-menu-container").sticky({topSpacing:0});
	});
</script>

<!-- Script for scrollNav.js -->
<script>
	jQuery(document).ready(function(){
		jQuery('.main-nav li a').addClass('page-scroll');
	});
</script>

<!-- Scrolling Scripts for Fixed Nav -->
	<script src="<?php echo get_stylesheet_directory_uri(); ?>/js/jquery.easing.min.js"></script>
	<script src="<?php echo get_stylesheet_directory_uri(); ?>/js/scrolling-nav.js"></script>
	<script src="<?php echo get_stylesheet_directory_uri(); ?>/js/jquery.sticky.js"></script>

</body>
</html>

Thanks for the help!

Nilambar Sharma on "About sanitizing hex color [sanitize_hex_color]"

$
0
0

I was looking for sanitizing HEX color value. I found function sanitize_hex_color and it is included in class-wp-customize-manager.php. Why is that function kept in there? I am trying to use it in my theme but it says function not found.


craig3690 on "Include image.php in php file"

$
0
0

Hi All

I'm new to PHP, in fact I started just today. Hope you can help me out

I am writing a PHP file and I want to include the

wp_generate_attachment_metadata function from the image.php file, I am getting the following error from the log

[06-Nov-2015 20:25:41 UTC] PHP Warning: include(): Failed opening '/wp/wp-admin/includes' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /wp/wp-admin/includes/imageupload.php on line 4
[06-Nov-2015 20:25:41 UTC] PHP Fatal error: Call to undefined function wp_generate_attachment_metadata() in /wp/wp-admin/includes/imageupload.php on line 9

My code is here

<?php
$root = 'My FTP Root';
$image = $root . '/wp/wp-admin/includes';
include($image);
$filename = $root . '/wp/wp-content/uploads/2015/11/02/AlbumTest-00001.jpg';
echo $root;
$attach_id = 10;
echo $attach_id;
$attach_data = wp_generate_attachment_metadata( $attach_id, $filename );
wp_update_attachment_metadata( $attach_id, $attach_data );
?>

Apologies if this is a noob question, like I said, I started today

Thanks

Craig

skalibran on "Understanding question: How to update values with wpdb"

$
0
0

Hey there,

for a project, I added a new row to the wp_users table called 'buildings'. Using wpdb, I want to update the values of this row. Maybe I'm dumb, maybe it was just a hard day, but I can't get my code working:

$table = 'wp_users';
$data = 'agdweft'; // My head on the keyboard, told you it was a hard day :D
$where = 'buildings';
$wpdb->update( $table, $data, $where);

That is based on the example:
<?php $wpdb->update( $table, $data, $where, $format = null, $where_format = null ); ?>

https://codex.wordpress.org/Class_Reference/wpdb#UPDATE_rows

I'm sure the connection is working fine, reading the values does not make any problems.

What am I doing wrong?

Thanks for reading!

linzD on "Using str_replace filter in WooCommerce"

$
0
0

I am trying to change some text on my WooCommerce Website.

Essentially, through a filter using the str_replace I'm trying to change the text '%s reviews for %s' to be something else.

This text is included in the single-product-reviews.php file.

See below:

<h2><?php
if ( get_option( 'woocommerce_enable_review_rating' ) === 'yes' && ( $count = $product->get_review_count() ) )
printf( _n( '%s review for %s', '%s reviews for %s', $count, 'woocommerce' ), $count, get_the_title() );
else
_e( 'Reviews', 'woocommerce' );
?></h2>

In order to do this I'm trying to use the following, but it doesn't seem to work. I'm not sure what string I should be targetting.

function lnz_replace_content()
{
echo str_replace("%s reviews for %s","%s comments about %s", $product);
}
add_filter('init','lnz_replace_content');'

Your help is much appreciated.

Thanks in advance.

Linz

hamstair_toilichte on "Custom relational database in a Wordpress installation"

$
0
0

Hello all

This isn't so much a 'how to', as a request to be pointed to roads to go down to get to my destination. In brief, my query is: how can I create a relational database in the WP database, and use forms to populate and query it?

In more detail:

I'm after creating a links 'repository' for subjects (eg healthcare, languages), which would be a multi-table relational database. For instance, I developed the Global Health repository as a custom web app, using PHP, MySQL and Codeigniter at the back end. Contributors add a web resource by URL, name, keywords, topic and a few other criteria, and this data goes into a MySQL database with around ten tables, linked by foreign keys or junction tables.

What I'd like to do is write a plugin to enable such a repository in Wordpress. An example of a repo I'd like to transfer into WP is a healthcare resources database. I'd like to do this for the plugin writing exercise, to contribute a little back to the community, and to provide a simple tool for the user to create their own link repo in whatever subject they want. The end user should be able to search/browse for resources in that subject via a simple form.

So I may want to add custom tables to the WP database and relate them as I want. I'm not sure, though, about the best way of approaching this. I'm thinking that I could maybe use the excellent Advanced Custom Fields plugin with some Custom Post Types, and use the dbDelta() function to create tables on plugin activation as advised in this article.

Alternatively, perhaps I shouldn't mess about with the WP database, but rather create a separate DB and run queries on that from within WP.

There could be a number of roads to go down, but I'd prefer to avoid those that may lead to dead ends, hence this rather fluffy query to the WP community. How would youse go about doing this sort of thing? Am I duplicating the work of an existing plugin? (I did search the plugin repo under various keywords but got 00s of hits.) Am I barking up the wrong tree completely?

If this post should go into the Plugins forum, let me know and I'll repost it there.

Klame on "Show Taxonomy Archive Page"

$
0
0

I'm going crazy...

I've have spend all day trying to achive this.
All tutorials and forums I read says the same. But it doesnt work for me!

I have created a custom post type, with custom taxonomy.

Everything is showing fine.
But when I click on taxonomy-link, nothing is showing - Only a standard message: "It seems we can’t find what you’re looking for".
How do I get a page, for items that has the same taxonomy to show?
..
When I read around:
"take your archive.php, copy, rename it taxonomy-taxonomy-slug.php and upload to child theme."

So I have created a taxonomy called Locations. Here I have New York.
Now I want all the post whit "New York" to show:
So in order to get this to work, I take archive.php and rename it - taxonomy-locations-new-york.php.

But it doesn't work!
Is that right? Or do I need to add a certain code?

This is the code for the custom post and taxonomy:

<?php
/************* The Post ***********************/
function register_job_post_type(){

	$singular = 'Job';
	$plural = 'Jobs';

	$labels = array (
		'name' 					=> $singular,
		'singular_name' 		=> $singular,
		'add_name' 				=> 'Add New',
		'add_new_item' 			=> 'Add New ' . $singular,
		'edit' 					=> 'Edit',
		'edit_item' 			=> 'Edit ' . $singular,
		'new_item' 				=> 'New' . $singular,
		'view_item' 			=> 'View ' . $singular,
		'search_term' 			=> 'Search ' . $plural,
		'parent' 				=> 'Parent ' . $singular,
		'not_found' 			=> 'No ' . $plural . ' found',
		'not_found_in_trash' 	=> 'No ' . $plural . ' in Trash'
	);

	$args = array(
		'labels' 				=> $labels,
		'public' 				=> true,
		'publicly_queryable' 	=> true,
		'exclude_from_search' 	=> true,
		'show_in_nav_menus' 	=> true,
		'show_ui' 				=> true,
		'show_in_menu' 			=> true,
		'show_in_admin_bar' 	=> true,
		'menu_position' 		=> 6,
		'menu_icon' 			=> 'dashicons-admin-site',
		'can_export'			=> true,
		'delete_with_user'		=> false,
		'hierarchical' 			=> true,
		'has_archive' 			=> true,
		'query_var' 			=> true,
		'capability_type' 		=> 'post',
		'map_meta_cap' 			=> true,
		// 'capabilities => array(),'
		'rewrite'				=> array(
			'slug' 			=> 'cpt',
			'with_front' 	=> true,
			'pages' 		=> true,
			'feeds' 		=> true,

		),
		'supports'			=> array(
			'title',
			'editor',
			'author',
			'custom-fields',
			'thumbnail'
		)
	);

	register_post_type( 'cpt', $args);
}
add_action( 'init', 'register_job_post_type' );

/****************** Taxonomy ***********************************/
function register_job_taxonomy(){

	$plural = 'locations';
	$singular = 'location';

	$labels = array(
		'name' 							=> $singular,
		'singular_name' 				=> $singular,
		'search_items'					=> 'Search ' . $plural,
		'popular_items'					=> 'Popular ' . $plural,
		'all_items'						=> 'All ' . $plural,
		'parent_item'					=> null,
		'parent_item_colon'				=> null,
		'edit_item' 					=> 'Edit ' . $singular,
		'update_item' 					=> 'update ' . $singular,
		'add_new_item' 					=> 'Add New ' . $singular,
		'new_item_name'					=> 'New ' . $singular . ' Name',
		'separate_items_with_commas'	=> 'Separate ' . $singular . ' with commas',
		'add_or_remove_items'			=> 'Add or remove ' . $plural,
		'choose_from_most_used' 		=> 'Choose from most used ' . $plural,
		'not_found' 					=> 'No ' . $plural . ' found.',

	);

	$args = array (
		'hierarchical' 				=> true,
		'labels' 					=> $labels,
		'show_ui' 					=> true,
		'show_admin_column' 		=> true,
		'update_count_callback' 	=> '_update_post_term_count',
		'query_var' 				=> true,
		'rewrite' 					=> array( 'slug' => 'location' ),

	);

	register_taxonomy( 'locations', 'cpt', $args);

}

add_action ( 'init', 'register_job_taxonomy' );

elsnare on "Dinamiccally pull value from database"

$
0
0

Hello guys!
I'm looking for a way to update editor content with value pulled from DB based on a select menu value.

The base code works something like this:

<select name="user_input">
<option value="ID1"></option>
<option value="ID2"></option>
<option value="ID3"></option>
</select>

global $wpdb;
$content = $wpdb->get_var( "SELECT content FROM $wpdb->table WHERE post_id=$user_input" );

$editor_id = 'mycustomeditor';
wp_editor( $content, $editor_id );

I need this to happen without a page reload.
I will greatly appreciate any help or tips.

atcchicago on "Wow Slider Blocks Menu- Don't know CSS"

$
0
0

I currently have wow slider on the home page of my NFP site. It blocks my drop down menus. Other forum posts explain how to fix this in CSS, but I'm not that savvy. I don't know how to do that. What can I do, in novice terms/skills?

http://atcchicago.com


drking on "form submission ajax woes on Ipad/Android"

$
0
0

I've written a plugin for private use. When a user lands on a particular page, identified by the pageslug, the plugin writes a <div></div> inside which is a form. When the form is submitted, the server sends back a response which is written into the <div></div> to replace the original contents. This works reliably on desktops. On Ipads and Android, the page simply resets, and the server does not react to the data from the form.

The code hereunder is a cutdown minimal version. It appears that Ipad/mobile browsers are prone to shutting themselves down to save memory and then restarting/refreshing - but if this is the case I don't understand why the server is not getting the info. Can the browser shut down while the javascript is running? Seems daft if so. Am I approaching this in the wrong way? I'd be grateful for any advice! Thank you.

The plugin is to allow members of a choir to say if they are available for a concert. I've had this working happily for some years outside WP using a different method, but can't do it that way in WP

////test.php
<?php
 /*
 Plugin Name: Test
 Description: test
 Version: 0.1
 Author: me
 */

//===== load script =====
function test_enqueue_scripts() {
	if ( $GLOBALS['post']->post_name == 'test' ) { // if this is our page, load our scripts
		wp_enqueue_script( 'test_js_handle', plugin_dir_url( __FILE__ ) . 'test.js', array( 'jquery' ) );
	}
}

add_action( 'wp_enqueue_scripts', 'test_enqueue_scripts' );

//===== every time any page is requested =====
function test_content_filter($content) {
	$name = $GLOBALS['post']->post_name;
	if ( $name == 'test' ) {
		return test_content();
	}
	return $content; // for all other pages
}

add_filter( 'the_content', 'test_content_filter' );

function test_content() {
	$html = "<div id='test_content'>";
	$html .= "<form method='post' id='test_form' onsubmit='test_submit()'>";
	$html .= "<input type='text' name='test_text' value=''>";
	$html .= "<input type='hidden' name='action' value='my_ajax_hook'>";
	$html .= "<input type='submit' value='send'>";
	$html .= "</form>";
	$html .= "<p id='ajax_url'>" . admin_url( 'admin-ajax.php' ) . "</p>";
	$html .= "</div>";
	return $html;
}

//===== ajax =====
function test_ajax_availm_page() {
	$user_id = 1; // admin
	$info = $_POST['test_text'];
	$user_id = wp_update_user( array( 'ID' => $user_id, 'user_url' => $info ) );
	echo 'I got: ' . $_POST['test_text'];
	wp_die();
}

add_action( 'wp_ajax_my_ajax_hook', 'test_ajax_availm_page' );
add_action( 'wp_ajax_nopriv_my_ajax_hook', 'test_ajax_availm_page' );

?>

////test.js
function test_submit(){
	var ajaxurl = jQuery("#ajax_url").text();
	var serialdata = jQuery("#test_form").serialize();
	jQuery('#test_content').html( "Please wait..." );
	jQuery.post(ajaxurl, serialdata,
		function(server_response){
			jQuery('#test_content').html( server_response );
		}
	);
}

makadore on "Custom url"

$
0
0

Hello.
A have url: example.com/appliance/dryer-repair/?state=CA&city=Denver&zip=90007
everything works fine.

Need url: example.com/appliance/dryer-repair/CA/Denver/90007

I do not know what to do. Tried htaccess, only works with one parameter

4dmin-Yael on "PHP problems"

$
0
0

Hi everybody,

I tried to erase something on plugins/single-page-per-category/includes/class-single-page-per-category.php

obviously, I made a mistake and now I can't get to the wp-admin and correct the code.

What should I do??

Thanks

interpol-ID337 on "My site stolen as soon as I created it"

$
0
0

Hello,
I set up a wordpress blog "dreambetweenthelines.com" AND paid for the website / url option. As I was creating it, I watched before my eyes as someone hacked it and stole administration. this was back in May. My computer was completely ruined and I finally saved up enough to buy a MAC and thus have more security now.
I started that site back on May 25. It was so upsetting, I haven't gone back to it. But I recently went back to try to reclaim it now that I have my MAC but my username for that site is not associated with me now. I PAID FOR THE URL, look at the name on the credit card I CAN VERIFY THAT CARD.
There's no way to get assistance here, I'm feeling screwed. Can anyone help me take back my wordpress site?

AmmaCanada on "Site hacked"

$
0
0

Hello, My site http://www.ammacanada.ca was hacked last night and the site was replaced with some malicious content. With the help of my security provider (www.sucuri.net), the malware was removed. However, now the site is not loading. All I see is a blank page. The security provider has asked for the backup site inorder to replace it. How can I get the backup files for my site ? It should be in an archive in the .zip or .tar.gz extension.

Viewing all 8245 articles
Browse latest View live




Latest Images