How to create a linked tag list in my sidebar

This will output a list of all tags, sorted by the most used tag first. Each tag has the number of times it has been used following the tag in parentheses. The parentheses and number of times used is in a <span>. To remove the parentheses, change <span>(‘ . $tag->count . ‘)</span> to <span>’ . … Read more

Add individual tag to widget title in sidebar

dynamic_sidebar_params is the filter that lets you modify those parameters on a per-widget basis. It fires for every sidebar though, so you’ll need to use both add_action & remove_action call. Try var_dump once before writing the code to get an idea of what you have to do ADDED AN EXAMPLE ON REQUEST This example adds … Read more

Sidebar links for different pages

Register a new sidebar by pasting this into your theme’s functions.php file: register_sidebars( ‘id’ => ‘patientedu’ ); Create a file called sidebar-patientedu.php and paste the following into it: <?php if (is_active_sidebar(‘patientedu’)) : ?> <div id=”sidebar”> <h2>PatientEdu Sidebar</h2> <?php dynamic_sidebar(‘patientedu’); ?> </div> <?php endif; ?> Then paste this whereever you want your sidebar to show up: … Read more

Where do posts get the sidebar from?

get_sidebar() accepts a parameter $name. Then will look for a file sidebar-{$name}.php. So what you can do is: get_sidebar( get_post_type() ); // search for sidebar-post.php or sidebar-page.php or: if ( in_category( array( ‘featured-listing’, ‘listing-post’ ) ) ) get_sidebar( ‘listing’ ); // sidebar-listing.php else get_sidebar();

Display the id list of active widgets of same sidebar?

Despite what you say is_active_widget does work on custom widgets as well. You may just have trouble locating its ID. To help you, here’s a snippet that will show the ID of a widget on the widget admin. add_action(‘in_widget_form’, ‘wpse202950_get_widget_id’); function wpse202950_get_widget_id($widget_instance) { if ($widget_instance->number==”__i__”){ echo ‘<p class=”widget-id-message”>’ . __(‘Save the widget to get its … Read more

Add custom element ID depending where the widget place is, sidebar or footer

Solved it by following the advice from @mmm. Using $args[“id”] did the trick. Using $args[“id”] will return the following: post-sidebar footer-first With a little change, my final code is: public function widget( $args, $instance ) { extract($args); // … <div id=’instafeed-<?php echo explode(“-“, $args[“id”])[0] ;?>’ class=”c-widget-instagram”></div> <?php echo $after_widget; } The result is: <div id=’instafeed-post’ … Read more

Custom sidebar on category pages

one way to accomplish your goal would be to create a child theme (https://codex.wordpress.org/Child_Themes). You create a folder inside /wp-content/themes/, then add a style.css file inside it with a few comment lines at the top to tell WordPress this is a child theme of whatever your current theme is. Sample style.css file: all you need … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)