Widget for specific category

I’d start with a basic widget tutorial. From there, I’d add a dropdown on the widget back end that lists out all the categories, so you can select from existing categories. Then on the widget front end, I’d do a WP_Query to pull a specific number of posts from that category. With posts selected, do … Read more

What is the best way to build home pages with a lot of sections for distributable themes [closed]

Due to historical context implementation of static front pages in WordPress is, simply put, a horror. This is not something it was meant to do originally and the way it was bolted on at a certain point is opposite of smooth. Under these constraints it would be hard to impossible to say what would be … Read more

get_comments_number() returns 0

From quick look at the source there seems to be three possibilities: get_post() returned falsy value, so current post context is invalid in some way. $post->comment_count is 0. get_comments_number filter is being used to adjust the output. Most commonly it would be case 1/2 with something interfering with global post context, dump get_post() at the … Read more

Adding a new setting using Kirki or WP customizer with an if statement

get_theme_mod in that context will only work after you save and refresh. In order to hide a control based on the value of another control you can use the active_callback argument in the 2nd control like this: Spotlight_Kirki::add_field( ‘spotlight_config’, array( ‘type’ => ‘radio’, ‘settings’ => ‘spotlight_layout_type’, ‘label’ => esc_html__( ‘Layout Type’ , ‘spotlight’ ), ‘section’ … Read more

Shortcode IF statment help

I am not really sure I understand the question. You would like to display different markup depending on which fields are set in the $atts array? If this is the case, then this should work: // Check so fields are set in the `$atts` array. if (isset($atts[‘img’], $atts[‘user’], $atts[‘text’])) { return ‘<div class=”hire-equipment-item”> <div class=”hire-equipment-item-img”> … Read more