wordpress-plugin

Redux Framework not working when used in plugin

女生的网名这么多〃 提交于 2019-12-07 19:14:10
问题 I'm going to use redux framework for my plugin options, it is showing in admin panel and i can save the settings, I used the sample config file for option panel, So the problem is that i m not getting the option values by printing the global opt_name variable. If I add the redux framework config file to theme functions.php then it worked, but not working in plugin, Please help me if some one know about the problem. 回答1: Lead dev of Redux here. The issue is Redux hasn't had a chance to run yet

Need help with remove_action()

僤鯓⒐⒋嵵緔 提交于 2019-12-07 18:48:27
问题 I'm trying to remove the unsightly embedded <STYLE> tag the built-in Recent Comments widget puts in my <HEAD> , but I can't seem to get the syntax right. It originally calls add_action( 'wp_head', array(&$this, 'recent_comments_style') ); to add it (in wp-includes/default-widgets.php, line 609), and I'm trying to undo it. I think it should be something like this: remove_action('wp_head', 'WP_Widget_Recent_Comments::recent_comments_style'); but with all the variations I've tried I still can't

Remove Yoast WordPress SEO on a page

℡╲_俬逩灬. 提交于 2019-12-07 15:55:46
问题 I am trying to remove the Yoast WordPress SEO on a certain page because it is conflicting with another plugin. I tried adding the code below to my functions.php but it does not seem to work, any help is appreciated. Thank You function remove_wpseo(){ if ( is_page(944)) { global $wpseo_front; remove_action( 'wp_head', array($wpseo_front, 'head'), 2 ); } } add_action('wp_enqueue_scripts','remove_wpseo'); 回答1: Enqueing is not the right moment to remove an action, use template_redirect instead:

Permalink change each post update in wordpress

ε祈祈猫儿з 提交于 2019-12-07 13:30:27
I want to have a custom permalink for each new post in WordPress like: http://mysite.com/x5Kvy6 . function wp_unique_post_slug($col,$table='wp_posts'){ global $wpdb; $alphabet = array_merge( range(0, 9), range('a','z') ); $already_exists = true; do { $guidchr = array(); for ($i=0; $i<32; $i++) $guidchr[] = $alphabet[array_rand( $alphabet )]; $guid = sprintf( "%s", implode("", array_slice($guidchr, 0, 12, true)) ); // check that GUID is unique $already_exists = (boolean) $wpdb->get_var(" SELECT COUNT($col) as the_amount FROM $table WHERE $col = '$guid' "); } while (true == $already_exists);

hide a woocommerce setting tab

試著忘記壹切 提交于 2019-12-07 12:35:41
问题 I would like to hide a specific woocommerce setting tab by user role. Not the entire submenu, but just a tab(checkout to be specific). I want shop managers to be able to access most of the settings, but be unable to affect the checkout settings. How can I achieve this? 回答1: If you want to remove the tabs instead of hiding them using CSS, then you can add the following to yours theme functions.php: add_filter( 'woocommerce_settings_tabs_array', 'remove_woocommerce_setting_tabs', 200, 1 );

Remove “page” from pagination URL

白昼怎懂夜的黑 提交于 2019-12-07 09:06:01
问题 I have problem with changing pagination URL in Wordpress. I know that universal solution for this is to changing Wordpress core files, but I need this solution only for one category. Maybe for only one category this can be done by htaccess? There is now URL like this: http://mysite.com/categoryname/ page /3 and I want change it to this: http://mysite.com/categoryname/3 Thanks for any response 回答1: You need to match against the %{THE_REQUEST} to ensure that you're matching against the actual

WordPress: How to show a metabox on any admin page?

Deadly 提交于 2019-12-07 08:13:46
问题 I already know how to register metaboxes for Posts, Page, and Custom Post Types, but I would like to register a metabox to be shown on my custom admin page, which is not a post. My plugin has an "Options Page" in the WordPress Admin – I would like to show metaboxes on this very page. Is this possible? If yes, how can this be acheived? I saw in the add_meta_box documentation that one of the possible values for the $post_type parameter is dashboard , however this is not documented anywhere. I

Woocommerce global product (multisite)

丶灬走出姿态 提交于 2019-12-07 07:13:02
问题 I set in wordpress the property multisite and activated woocommerce on my network. My network is formed by a primary site and a subsite. I would like to see from the subsite see the products on the primary site, and products, attributes and categories in the admin bar corresponding products. Does anyone know how to do? 回答1: Yes, you can do it with the WooCommerce MultiStore plugin. These are a few of the plugin's main features: Any Product can be replicated across network, making it available

wordpress schedule event not firing in set time

独自空忆成欢 提交于 2019-12-07 06:15:17
问题 In WordPress I am creating a plugin where I am sending email to users. For that I am using WordPress cron job. So basically what it will do is just send emails to users in every hour. So my code looks like this public function __construct() { add_action('init', array( $this, 'send_emails_to_users') ); add_action('cliv_recurring_cron_job', array( $this, 'send_email') ); } public function send_emails_to_users() { if(!wp_next_scheduled('cliv_recurring_cron_job')) { wp_schedule_event (time(),

Wordpress preview_post_link

馋奶兔 提交于 2019-12-07 05:23:25
问题 I am trying to alter the default "preview post" button when posting on wordpress as the site has a hacked wordpress install and the posts previews are not where they are suppose to be. I found the hook preview_post_link now I am just trying to figure out how to make a little plugin that will fix the problem. What I don't know how to do and why I am posting here is, using the add_filter to change the link add_filter( 'preview_post_link', 'the_preview_fix' ); function the_preview_fix() { return