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; } }

WordPress widget in custom theme

You have to hook your widget registering like that: add_action(“widgets_init”, “register_widgets”);// Hook WP /** * Register widgets */ function register_widgets() { require_once “FooWidget.php”; register_widget(“FooWidget”); } Same for the widget zones add_action(“widgets_init”, “register_widgets_zones”); function register_widgets_zones() { register_sidebar(array( “name” => “Foo Zone Page”, “id” => “foo-zone-widgets”, “class” => “panel”, “before_widget” => ‘<div id=”%1$s” class=”widget %2$s”>’, “after_widget” => … Read more

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