wordpress-plugin

Redirect from add_menu_page

青春壹個敷衍的年華 提交于 2019-12-06 02:11:57
问题 I have added a menu using add_menu_page which all works correctly, but when clicked I want this menu page to open the post editor for a particular post id. As a proof of concept i have tried echoing a javascript redirect out into the do function like so... // Load up the menu page function register_availability_custom_menu_page() { add_menu_page('custom menu title', 'Availability', 'add_users', 'options', 'options_do_page'); } function options_do_page() { echo "<script type=\"text/javascript\

WooCommerce: Cart price override with text

限于喜欢 提交于 2019-12-06 01:52:28
问题 We have a bunch of products with either: No price Zero price We made them purchasable with the built-in hook but the cart still displays them as having a 0 price during checkout. We'd like the cart & checkout summary to display "Special order" or any other text, but it seems WooCommerce invalidates text-based prices. Tried this : WooCommerce: Add product to cart with price override? The above works fine with a number override, but when tried with a text override it defaults back to displaying

hide a woocommerce setting tab

自作多情 提交于 2019-12-05 21:37:40
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? 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 ); function remove_woocommerce_setting_tabs( $tabs ) { // Declare the tabs we want to hide $tabs_to_hide = array(

Remove Yoast WordPress SEO on a page

不问归期 提交于 2019-12-05 20:29:08
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'); Enqueing is not the right moment to remove an action, use template_redirect instead: add_action('template_redirect','remove_wpseo'); function remove_wpseo(){ if ( is_page(944)) { global $wpseo

Custom validation is not working in Contact Form 7 in ver 4.1.1

穿精又带淫゛_ 提交于 2019-12-05 16:59:33
I have to make a form with custom validation field in contact form 7. It is not working with latest version (4.1.1) of Contact Form 7 but working in older version. I have created a field for getting coupon code from the form. I want to validate the entry if the coupon is started from "HIP". My code is given below: add_filter( 'wpcf7_validate_text', 'your_validation_filter_func', 999, 2 ); add_filter( 'wpcf7_validate_text*', 'your_validation_filter_func', 999, 2 ); function your_validation_filter_func( $result, $tag ) { $type = $tag['type']; $name = $tag['name']; if ( 'coupon_code' == $name ) {

How to share my wordpress posts into instagram [closed]

谁都会走 提交于 2019-12-05 16:23:22
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . Does anyone has an idea how to use instagram api for sharing photos from my WordPress site into my instagram account? 回答1: According to Instagram: At this time, uploading via the API is not possible. We made a conscious choice not to add this for the following reasons: Instagram

How to parallelize downloads across hostnames on WordPress?

荒凉一梦 提交于 2019-12-05 16:21:22
I'm getting this message "Parallelize downloads across hostnames" when checking my WordPress site on GTmetrix > https://gtmetrix.com Here are the details > https://gtmetrix.com/parallelize-downloads-across-hostnames.html How do I fix that ? Details Web browsers put a limit on the number of concurrent connections they will make to a host. When there are many resources that need to be downloaded, a backlog of resources waiting to be downloaded will form. The browser will make up as many simultaneous connections to the server as the browser allows in order to download these resources, but then

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

南楼画角 提交于 2019-12-05 16:13:42
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 guess it would show the metabox on the WordPress Dashboard (the main admin screen when logging-in),

Want to overwrite functions written in woocommerce-functions.php file

巧了我就是萌 提交于 2019-12-05 15:29:04
问题 I want to modify/overwrite functions written in woocommerce-functions.php file but I don't want to modify woocommerce-functions.php file. That is I want to achieve this in plug-in or in my theme. 回答1: It is possible to override woocommerce functions, I did this recently and added all of my woocommerce extended functionality to my theme's functions.php file so that the woocommerce plugin files remained untouched and are safe to update. This page gives an example of how you can remove their

Remove “page” from pagination URL

浪尽此生 提交于 2019-12-05 15:24:57
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 You need to match against the %{THE_REQUEST} to ensure that you're matching against the actual request and not an internally rewritten URI: RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /categoryname/page/([0-9