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

hankorstanje on "English and Thai unicode return in %%% format if use thai"

$
0
0

If I create a top-level (parent) page using the default English and save it, the page name is "English-name" taken from the page slug. When I then add a Thai translation, the translation's name in the database is the English-name translated and saved in Thai script - this is correct and works great.
If I then create a child-page, so that the slug becomes /parent-page/child-page, the child-page name records correctly, but the parent-page part of the name and slug "corrupts" to being in some sort of unicode code - it's a long string of %23B12 etc characters that are neither English nor Thai.
The strange thing is that in the browser, the page url shows correctly as /parent-page/child-page/ in either English or Thai, BUT if you copy the URL from the browser address bar and paste it into an email or text editor etc, then it reverts to the unicode characters for the parent-page within the Thai version of the URL.


jamierob on "woocommerce display image captions in single-product thumbnail display"

$
0
0

I'm trying to display the image caption underneath each product thumbnail on the single-product page and can't figure it out. I know I need to change something in the template/single-product/product-thumbnails.php file:

$image_link = wp_get_attachment_url( $attachment_id );

			if ( ! $image_link )
				continue;

			$image       = wp_get_attachment_image( $attachment_id, apply_filters( 'single_product_small_thumbnail_size', 'shop_thumbnail' ) );
			$image_class = esc_attr( implode( ' ', $classes ) );
			$image_title = esc_attr( get_the_title( $attachment_id ) );

			echo apply_filters( 'woocommerce_single_product_image_thumbnail_html', sprintf( '<a href="%s" class="%s" title="%s" data-rel="prettyPhoto[product-gallery]">%s</a>', $image_link, $image_class, $image_title, $image ), $attachment_id, $post->ID, $image_class );

			$loop++;
		}

kiannachauntis on "Grab Taxonomy name rather than ID in custom search"

$
0
0

Hey all!

So, I'm coding my first search filtering system from scratch. I was originally using the Search & Filter plugin, which works like a dream, however with the way in which my client want to style the dropdowns and wire the search differently on certain pages, we've decided to nix the usage of plugins and opt in for coding something with just the bare minimum of what we need to get this working.

That being said, I have a custom post type called "brands" and am currently working to add a handful of custom taxonomies via dropdowns so users may filter their search with ease. I'm really close to getting the code to work, however for whatever reason my current code seems to be grabbing the taxonomy term ID rather than its actual name and applying it to the search.

So, if I am searching by brand location- and I select "California" from the location dropdown, then type clothing- the search url *should* render as

http://www.mywebsite.com/?brand-location=california&s=clothing&post_type=brands

instead- what I'm getting is

http://www.mysite.com/?brand-location=48&s=clothing&post_type=brands

Which obviously displays a "Nothing Found" page as well as a drop of table-flipping rage for myself :p

I'm currently using this code within the search form to display my state location dropdown:

<?php
$args = array('taxonomy' => 'brand-location',
    'hide_empty' => 1,
    'echo' => 1,
    'name' => 'brand-location'
);
if (isset($_GET['brand-location'])){ $args['selected'] = intval($_GET['brand-location']);
}
wp_dropdown_categories( $args );?>

I'm moderately new to PHP, and I'm sure the solution is fairly simple and will make me feel like an uber-n00b for not figuring it out sooner, but I've done quite a few searches at this point and can't seem to find an answer that isn't someone recommending the use of a plugin instead.

Any ideas or help would be appreciated!

chadrew on "Is there an action which fires when pressing "Preview Changes"?"

$
0
0

I have a custom field where I add "event date" in a human readable format. Then I use the following function to convert it to unix timestamp so the posts can be arranged and sorted by event date rather than their publishing date. This is for my convenience so I don't have to convert to timestamp manually for every new post.

add_action('save_post', 'convert_date');
function convert_date($post_ID) {
	global $wpdb;
	if(!wp_is_post_revision($post_ID) && get_post_meta($post_ID, 'final', true)) {
		$datecheck = strpos(get_post_meta($post_ID, 'final', true), ' ');
		if ($datecheck !== false) {
			$converted = strtotime(get_post_meta($post_ID, 'final', true));
			if ($converted != false) {
				update_post_meta($post_ID, 'final', $converted);
			}
		}
	}
}

It fires automatically when a post is published or updated. It also used to fire when I clicked "Preview Changes". However, after some WordPress update it no longer happens. The date isn't displayed on the preview, and "date() expects parameter 2 to be long, string give" error is generated every time.

This is more an annoyance than anything, but is there an action besides save_post that I can use which would work with the "Preview Changes" button as well?

natepelzel on "Universally Change Iris Palette"

$
0
0

Hey guys,

I use wordpress on most of my client's site, and I recently had the idea to alter the palette below the Iris color picker to match my client's color scheme. Make it quicker for me and easier for them.

I did some digging and found this site. It basically just said to paste this in my functions.php:

// customise palette colours
function firefly_customize_controls_print_footer_scripts() {
?>
<script>
jQuery(document).ready(function($){
$.wp.wpColorPicker.prototype.options = {
palettes: ['#ffffff', '#000000','#ff0000']
};
});
</script>
<?php
}
add_action('customize_controls_print_footer_scripts', 'firefly_customize_controls_print_footer_scripts');

Makes sense in theory, but I'm having the hardest time getting it to work. The script is definitely running. In my troubleshooting I put an alert in the script and it most definitely fired.

Any idea what I'm missing? I checked some color pickers on a few different pages, including one for my theme's built in settings and some in the theme customization page.

I'm pretty strong with php & css, and have been dabbling in javascript/jQuery for a while now, so I'm comfortable but not fluent with it.

Any ideas you all have would be greatly appreciated.

Pam Blizzard on "add post type support - multiple post types in one declaration"

$
0
0

My php kungfu is not strong yet. I'm learning :)

I know I have to:
add_post_type_support( 'state', 'genesis-simple-sidebars' );
get to get some of my plugins to recognize my custom post types.

But I have multiple custom post types (state, location, event and more)

Instead of listing multiple "add_post_type_support(..." lines is it possible (and even more efficient) to list them all in one declaration? I checked the codex but didn't see an example using an array.

Thanks for helping me learn :)

filetazz on "Casino Hacks"

$
0
0

Some one Hackers Tricke's to Re-Modified Video SEO for WordPress SEO by Yoast and Re-published it for free...

Just De-activate It, to avoid unwanted pages like casino, mobile-bingo,maryland-gambling, casino-bonus-ohne-einzahlung,

or

1. De-activate all plugin
2. Activate One and Check your http://www.yourdomain.com/mobile-bingo/ or any

like that check one by one plugin - this way to find easily which plugin is malware or infected.

tihomirmat on "Redirect to thank you page after submit"

$
0
0

I am trying to redirect users to THANK YOU page after submitting. I use default theme contact form. I'm a complete novice and don't know how to make it work.

http://tetefinance.si/kontakt/

Thank you for your answer


ggoaga on "my sites hacked. all plugins gone."

$
0
0

My plugins are gone. It seems like a malware got in.
I see this php that looks strange:
wordpress_admin_payload2AhfAMGz.php (in the root of the site)

Can I delete it????
the malware create a new admin account ....

<?php
error_reporting(0);
if ($_GET['ping']) {
echo 'Pong';
exit;
}
@ini_set('cgi.fix_pathinfo', 1);
if (!$_POST) {
@unlink(__FILE__);
}

define( 'DS', DIRECTORY_SEPARATOR );
require_once ($_POST['full_install_path'] . 'wp-blog-header.php');
require_once ($_POST['full_install_path'] . 'wp-includes' . DS . 'registration.php');
require_once ($_POST['full_install_path'] . 'wp-admin' . DS . 'includes' . DS . 'user.php');
$Admin = new WordPressAdmin($_POST);
@unlink(__FILE__);
exit;
/**
* Pre Installer Payload Script
*
* This is called via curl. The settings are passed in the headers and the process is run
* on the remote server.
*
* @subpackage Lib.assets
*
* @copyright SimpleScripts.com, 8 May, 2012
* @author
**/

/**
* Define DocBlock
**/
class WordPressAdmin {

/**
* Debug Storage
*
* @var array $debug
*/
public $debug = array();

/**
* Settings
*
* @var array $settings
*/
public $settings = array(
'token_to_match' => '',
);

/**
* Class Constructor
*
* The $_POST will be sent to this method and merged into the $settings defaults.
*
* @author
**/
public function __construct($settings = null) {
if (!$settings) {
return false;
}
$this->debug['setup'][] = 'Configuring settings.';
$this->settings = array_merge($this->settings, $settings);
$this->settings['os'] = strtolower(substr(PHP_OS, 0, 3));
$this->settings['passthru'] = function_exists('passthru') ? true : false;
$this->settings['root_directory'] = dirname(__FILE__);

if ($this->settings['create_admin'] == 1) {
if (!$this->createAdmin()) {
$this->errorDie();
}
}

if ($this->settings['destroy_admin'] == 1) {
if (!$this->destroyAdmin()) {
$this->errorDie();
}
}
$this->debug['status'] = 'success';
echo serialize($this->debug);
}

public function createAdmin() {
$newusername = $this->settings['ss_admin_user'];
$newpassword = $this->settings['ss_admin_pass'];
$newemail = $this->settings['ss_admin_email'];
if (!username_exists($newusername) && !email_exists($newemail)) {
$userId = wp_create_user( $newusername, $newpassword, $newemail);
if (is_int($userId)) {
$wpUser = new WP_User($userId);
$wpUser->set_role('administrator');
$this->debug['ss_admin_id'] = $userId;
$this->debug['notice'][] = 'Admin successfully created';
} else {
$this->debug['error'][] = 'User Not created';
return false;
}
} else {
$this->debug['error'][] = 'Username found';
return false;
}
return true;
}

public function destroyAdmin() {
if (!wp_delete_user($this->settings['ss_admin_id'])) {
$this->debug['extra'][] = 'fail';
return false;
}
return true;
}

/**
* Error
*
* Call an error to pass back to the caller.
*
* @return void
*
**/
public function errorDie() {
$this->error['status'] = 'error';
$this->error['debug'] = $this->debug;
$this->error = serialize($this->error);
@unlink(__FILE__);
die($this->error);
}
}

EmadQmars on "anti hack"

$
0
0

hello anybody
i want a plugin for security my site
please give me a best plugin
thanks all

-------------------------------------
هتل های مشهد

azubets21 on "Get the plugin to Scroll to a certain point on a page"

$
0
0

Hey everybody,

What I am trying to achieve:
Make a floating button on a page (that appears after a bit of scrolling down) which upon clicking will take the user to a certain point on a web page. Same web page AND another web page.

What have I got so far:
Installed a plug-in "JCWP ScrollToTop" and changed the text to what I need. I have added anchor(s)

*a href="#buyxk">BuyKeeper</a* and *a id =" #buy"></a*.

Where * is < or >

What I need help with:
Basically, the anchor won't work even when I manually type it in the URL. So, I need your help with the Anchor code.
Also, I want to know what is the best way of modifying a plug-in to get the user to the Anchor instead of the #top of the page.

Also, what I am trying to do here is even possible??

If yes, what is the best way to go about it?

Thank you in advance for all your input!!

[here is my site if you need: x-keeper.in.ua] the plugin is currently on.

operandom on "How to restrict access to some parts of the front end from capabilities"

$
0
0

Hi all!

I'm writing a plugin with custom post types and I want to restrict access of the single-template to users having specific capabilities but I can't find anything on the web on how to perform this. Any ideas ?

Thx!

SEO Consulting Charlotte NC on "Calling a MySQL stored proc with wpdb"

$
0
0

No one has any idea of how to successfully call a stored procedure using WPDB?

Tomas Mackevicius on "Use secondary menu of parent theme in child theme"

$
0
0

Hello, I posted this question to this board, because it looks to me, that WP core doesn't support this feature, I'm not sure if it should work, but it would be nice if someone with knowledge could clarify this.

All cases that I found on the internet deal with the new secondary menu that should be registered and used in a child theme. In my case I have a parent theme with two registered menus and I have a child theme, where I want to use both of them. There is no problem with the 'primary' menu, somehow even without registering it works in a child theme out of the box.

The problem is that secondary menu will not be generated when called from the child theme. For details please see this question at wp stackexchange:

https://wordpress.stackexchange.com/questions/177414/use-secondary-menu-of-parent-theme-in-child-theme

Thank you!

iGetPro on "Swap the Javascript 'JQuery' over on two pages"

$
0
0

I need to be able to swap the javascript 'jQuery' from each one of these pages to the other. The script that I need to swap is the drop down menu that appears when you click on the menu item. Any assistance would be greatly appreciated.

This is the one page:

[excessive code removed]


absiddik on "How to add admin menu icon for new plugin ?"

$
0
0

I'm new learner of WordPress Plugins development. I was created a admin bar menu for my plugin but I can't add menu icon.

$wp_admin_bar->add_menu( array(
	'id' => 'Visit',
	'title' => __('<img src="'.get_bloginfo('wpurl').'/icon.png" style="vertical-align:middle;margin-right:5px" alt="Visit Site" title="Visit Site" />Visit Site' ),
	'href' => get_bloginfo('wpurl')
));

I used this code but the icon didn't come.

Anybody can help me ?

latro666 on "WordPress's poor ability to edit link text in TinyMCE"

$
0
0

Hi

So hit a bit of an issue with a client. They would like to edit links easier in the editor in normal tinyMCE you can click on a link and edit it and the 'text to display' field appears in the popup to change this text.

Default WordPress for whatever reason does not include this handy option and forces you to try and edit the link text in the editor which is easier said than done as you have to basically delete all but the first and last chars and then type in what you want and finally deleting those two e.g.

some link i dont like the text for
sr
smy new link titler
my new link title

As far as i can see this is the only way to edit the link text in the editor without un-linking the hyperlink or adding it again from scratch - shocking really.

I know the tinyMCE advanced plugin can re-instate this MCE popup but in doing so it gets rid of the nice link picker of pages posts etc that WordPress provides! bit of a catch22.

Just wondered if anyone has a work around for this some sort of hook that could be added in the functions file of the theme? I expect its not as straightforward as that as i'v looked at the core WP file that drives that popup and it looks fairly bespoke so a plugin might be the route?

still trying to think of the best approach any ideas appreciated.

ThreeD on "How to pass post/page title when clicking button?"

$
0
0

Hi, we have a website where we've added some donation buttons.

When the visitors clicks the "Donate now" button, we would like the following page to clearly tell the visitors what cause they are supporting.

How can we pass the page / post title in the form of "You are now donating to the example #1 cause" (where "Example #1" would be the page title) of the first page into the next page where the users fills out all his personal information?

Thank you for all replies in advance.

Tom Dworzanski on "What do the schemes login, login_post, admin, and relative mean?"

$
0
0

site_url and get_site_url accept a parameter named $scheme. $scheme can be set to http, https, login, login_post, admin or relative.

http and https are obvious schemes.

What do login, login_post, admin and relative do? What scheme does each of these provide and when/why?

Jeroen Schmit on "Increase length of passwords"

$
0
0

I need to migrate user login from another system. Their passwords are stored as 255 character hashes.

I know I need to write my own wp_hash_password() and wp_check_password() functions.

However, the user_pass field in the wp_users table is set to varchar(64). Is it safe to change this to varchar(255)? Or will this be overwritten when WordPress gets updated?

Viewing all 8245 articles
Browse latest View live




Latest Images