Create a new recent post widget

My widget was like this: public function __construct() { $widget_ops = array( ‘classname’ => ‘yggdrasil_widget_recent_entries’, ‘description’ => __( ‘Your site’s most recent Posts.’ ), ‘customize_selective_refresh’ => true, ); parent::__construct( ‘recent-posts’, __( ‘Recent Posts’ ), $widget_ops ); $this->alt_option_name=”yggdrasil_widget_recent_entries”; } Below works as a new widget without overriding the default wordpress recent posts public function __construct() { … Read more

Customizing the output of the archive and category widget without altering the original behavior of the widget

No, there are no filters for doing this. You would need to create your own version of the widgets in order to achieve this. You can find the default WordPress widgets in the following folder: /wp-includes/widgets in your WordPress installation. Simply copy the code from within the respective widget .php files in to your theme … Read more

Before_widget won’t show up

Thanks to Tom J Nowell I found out that the reason for after_widget and before_widget NOT appearing was that I used my own widget and inside my own widget I had commented out: //echo $args[‘before_widget’]; and //echo $args[‘after_widget’]; So as soon as I tested it with the default wordpress “Custom HTML” everything worked fine and … Read more

How to display a loop of custom post types in columns

This is an HTML/CSS question. Your PHP is mostly fine as is. You just need to remove the <br> from your code. Then, in your CSS, use ‘float’ to make the columns out of the divs. More info https://learn.co/lessons/css-column-structure-using-floats

Dynamic_sidebar load in string makeup

You could use output buffering to catch the display of the sidebar. This does make it a bit more difficult to debug should you need to but it will get you what you need: ob_start(); dynamic_sidebar( ‘header-widget’ ); $sidebar = ob_get_clean(); $menu_markup = ‘<header class=”%s header”>’ . $sidebar . ‘</div>’;