Woocommerce category description as subtitle

There is an extra hook you can use for this woocommerce_archive_description, hook into it like this: add_action( ‘woocommerce_archive_description’, ‘wc_category_description’ ); function wc_category_description() { if ( is_product_category() ) { global $wp_query; $cat_id = $wp_query->get_queried_object_id(); $cat_desc = term_description( $cat_id, ‘product_cat’ ); $subtit=”<span class=”subtitle”>”.$cat_desc.'</span>’; echo $subtit; } }

Problem running Ajax in WordPress

1: the codex recommends enqueing all scripts and styles on the wp_enqueue_scripts() hook. this won’t solve the problem, but is good practice. 2: i think that all the data that goes INTO the php function is wrapped up in $_POST. which is sent by the .ajax call. so it doesn’t look like you are sending … Read more

Custom interval is not working

Note on input arguments: You are using the filter callback function (FCB) with two input arguments, but the default is one. In general you should replace: add_filter( ‘some_filter’, ‘some_filter_callback’ ); function some_filter_callback( $arg1, $arg2 ) { with something like: add_filter( ‘some_filter’, ‘some_filter_callback’, 10, 2 ); function some_filter_callback( $arg1, $arg2 ) { if you want two … Read more

Twillio How To Send SMS for Custom Post Type

You should be able to change publish_post to publish_sms then remove any conditional logic. This is due to the following hook: https://developer.wordpress.org/reference/hooks/new_status_post-post_type/ This is a bit of an aside, but I’m making the assumption you’ve defined your post type key as sms (all lowercase) if not then you may need to use publish_SMS but it’s … Read more

Get userdata inside custom build plugin

There are 2 reasons why get_userdata fails and both are related to the fact that it is a pluggable function. Pluggable functions can be overriden by plugins, so if a plugin override that function, and the plugin is poorly coded, that function can fail. However this is not the most common reason why using that … Read more

Custom Widget outputs the input but doesn’t save anything inside the textarea

Your primary issue isn’t with saving the data but displaying in the form if it has been saved. I rewrote the offending function: function form($instance) { $title = strip_tags( $instance[‘title’] ); $info = esc_textarea( $instance[‘info’] ); // var_dump($instance); // debug ?> <p> <label for=”<?php echo $this->get_field_id(‘title’); ?>”><?php _e(‘Title:’); ?></label> <input class=”widefat” id=”<?php echo $this->get_field_id(‘title’); ?>” … Read more

Detecting $_GET parameters from any page + Cookie

This should work, though untested. <?php add_action(‘send_headers’, ‘affiliate_redirect’); function affiliate_redirect() { // it’s possible to use ‘if( !empty( $_GET[‘affid’]) )’ if( isset($_GET[‘affid’]) && ” != $_GET[‘affid’] ) { if( empty($_COOKIE[‘affid’]) ) setcookie(‘affid’, $_GET[‘affid’], time()+2592000, “https://wordpress.stackexchange.com/”); header(‘Location: http://mysite.com/about/’); exit; } }

Some plugins adding full server path after url (with custom wp-content folder)

Given that the js location is determined as follows: $js_location = WPSEO_URL . ‘js/wp-seo-admin-global.js’ where: WPSEO_URL = WP_PLUGIN_URL . “https://wordpress.stackexchange.com/” . <WP_SEO_PLUGIN_PATH> . “https://wordpress.stackexchange.com/” I suspect the problem lies with the derivation of <WP_SEO_PLUGIN_PATH>. This value is determined by the code in the function plugins_url() found in wp-includes\link-template.php If you debug that function, it may … Read more