New answers tagged

0

You have to put the function footer_sidebar() in the file functions.php not sidebar.php Is the footer.php included on site you opened the customizer?


2

Just add a variable to the function so you can call it differently from the template... EDITED: pass the footer row to function and return class... function mytheme_footer_sidebar_class($row) { if ($row == 1) {$i = 1; $j = 5;} elseif ($row == 2) {$i = 5; $j = 9;} $active_sidebars = 0; for ($i; $i < $j; $i++) { if ( ...


1

Or little bit simplier. function do_shortcode_only_for($content, $tagnames) { $pattern = get_shortcode_regex($tagnames); $content = preg_replace_callback("/$pattern/", 'do_shortcode_tag', $content); return $content; } Taken from original do_shortcode function.


0

You can create new sidebar areas by adding the following code to your theme's functions.php register_sidebar( array( 'name' => __( 'Content Sidebar', 'mytheme' ), 'id' => 'sidebar-2', 'description' => __( 'Sidebar description', 'mytheme' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', ...


-2

So that was a wonderful idea! I decided to inspect the HTML elements and removed the pieces of code that had a matching pair. I realized they all had a matching pair; however, for some reason, the second column's container was enveloping the third column's container to make it a sub-container if that makes sense? Here's the code snippet I managed to parse ...


2

As far as I can tell, the most right column is being nested within the middle reviews column. I imagine that somewhere in the code (template, sidebar, or widget) there is a conditional statement causing your middle column to not get closed off before the right column starts. To illustrate what is happening, this is how it currently gets rendered: <div ...


-1

You have 2way to active your class . you can create a folder inside plugins folder ... you can include in functions.php like as Bellow require_once(get_template_directory().'My_Widget.php');


1

I copied the class definition and register_widget( 'My_Widget' ); to my theme's functions.php file & it did show My Widget under Appearance > Widgets. So please place this code directly in your theme's functions.php file. It is not recommended to edit anything in wp-includes directory.


1

I don't think it is possible in a nice user friendly way. Wordpress admin screen and the customizer assume that any widget can get into any sidebar and will show them as part of the admin, so even if you filter out the widgets you do not want, it will probably create a lot of WTF moments for the user. I would just suggest not to go that way. If you need to ...


-3

First to you register widget area for your desired loacation like header, footer or sidebar. If you don't already have any widget areas registered, you'll need to add this code to your functions.php file: <?php function headertest_widgets_init() { // First widget area register_sidebar( array( 'name' => __( 'First Widget Area', ...


1

It is possible. Look at the in_widget_form hook. Saving to the instance is the widger_update_callback hook.


1

Alternatively you can use this plugin I've created for this purpose : https://wordpress.org/plugins/hide-widgets/ Cheers!


0

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 ...


0

You only want to add a class name based on the counts. Your above code looks like you may have copy/pasted from somewhere but you don't need all that. I just tested this with wp_generate_tag_cloud_data (#L869) and wp_tag_cloud() and it's working. Unfortunately for a basic test site like mine, the small count represents the largest number of tags for me. ...


1

You can add a link to the widgets.php like that: add_action( 'admin_menu', 'f711_add_widgets_shortcut', 999 ); function f711_add_widgets_shortcut() { add_menu_page( 'Widgets', 'Widgets', 'publish_pages', 'widgets.php', '', '', 61 ); } Be sure to check your permission settings, and you may also include another image. You can find the documentation ...


0

Not sure I entirely understand what you need - but try changing the else statement to this: else { $service_class = "tg-one-third tg-item-" . $j; } It should add another class to each, i.e. 'tg-item-1', 'tg-item-2', etc. - allowing you to target those specific divs


0

If you have a custom field (metadata) attached to a particular post, page or custom post type, you can do something like the following in your page template file: Example example-template-file.php <?php $sidebar_id = 'my-custom-sidebar-id'; $my_custom_meta_value = get_post_meta(get_the_ID(), 'my_custom_meta_key', true); if ( ...


0

So, the actual problem was that I wasn't setting any defaults my custom widget needed to display any content. The widget actually was there, but as I had emptied the title and set no other defaults, it was rendering nothing. My fix for this was two-fold. 1) set at least one default in my install.php file update_option( 'widget_vvnumetawidget', array ( 2 ...


0

Custom Archive Page What you're describing is a custom archive page. https://www.google.com/search?q=custom+archive+page https://codex.wordpress.org/Creating_an_Archive_Index Child Theme Forget widgetised areas. They're not necessary based on what you described. Simply fork (copy and manipulate) your archives template page by using using a child theme ...



Top 50 recent answers are included