How do you create dynamic customised sections in WordPress?

One common way to do similar task is creating a page template. For example: <?php /* Template Name: Reviews and Quotes */ get_header(); ?> <div id=”content”> <div id=”reviews”> <?php $reviews = get_the_reviews(); foreach( $reviews as $review ) { <?php <div class=”review”> ….. </div> ?> } ?> </div> <div id=”quotes”> <?php $quotes = get_the_quotes(); foreach( $quotes … Read more

instance is empty in function widget()

Your widget really has a lot of issues and completely breaks my layout on my back-end widget page. I suggest that you start at the Widget API to learn the proper way how to code a widget Here is a couple of issues I have picked up: Reputable sources should not be suggesting or even … Read more

Warning: Missing argument 2 for widget_title filter

You don’t pass more than argument to that filter, so any callback expecting more than one will not get it. The core calls this filter always like this: $title = apply_filters( ‘widget_title’, empty($instance[‘title’]) ? ” : $instance[‘title’], $instance, $this->id_base ); But you are passing just $instance[‘title’]. Add the missing parameters, and the error will vanish. … Read more

How to run PHP code in Text Widget with no plugin in WP 4.4

Better to write your own widget that does precisely what you need instead of something like this. However, if you really want to execute arbitrary PHP in a widget, use a plugin specifically designed for that task: https://wordpress.org/plugins/php-code-widget/ I maintain this plugin specifically so that people don’t resort to doing things like what you have … Read more

I can’t get my custom widget area to show on my WordPress site

Your have created three sidebars and that are primary_widget_area, secondary_widget_area, footer_widget_area But in the sidebar, you call a different sidebar name sidebar-3; that’s why your sidebars are not displaying. Try the following code in sidebar.php: // To display primary_widget_area sidebar <?php if ( is_active_sidebar( ‘primary_widget_area’ ) ) : ?> <?php dynamic_sidebar( ‘primary_widget_area’ ); ?> <?php … Read more

Can I individually style items in the backend widget list?

Just as @MarkKaplun mentioned in a comment, it’s possible with CSS. Also with Javascript. CSS Approach Let’s look at the Calendar widget, as an example. The id for the widget, in the available widgets list, is of the form: widget-{integer}_calendar-__i__ and in the sidebar it’s: widget-{integer}_calendar-{integer} If we want to display the calendar dashicon before … Read more