Any reason why widgets/menus get emptied when I updated custom theme code?
Any reason why widgets/menus get emptied when I updated custom theme code?
Any reason why widgets/menus get emptied when I updated custom theme code?
Here is a cleaner method which does not skip the first post in the loop As this is the main query on the home page, we can do the following: Use pre_get_posts to alter the main query on the homepage so as to set an offset of one so that the newest post is ignored. … Read more
You can write the logic inside widget functions. When the widget is added in sidebar, it will check for sidebar name and home page. global $wp_registered_widgets, $wp_registered_sidebars; $sidebars_widgets = get_option(‘sidebars_widgets’); if($sidebars_widgets[“sidebar-1”] && is_home()) { //Write your logic here }
You have a $facebook = $instance[‘youtube’]; instead of $youtube = $instance[‘youtube’];
Sidebar generator plugin is best solution for your logic? If you would like to add sidebar even in taxonomy or tag, you would need to create meta field or option field for that. Below example codes is good for static sidebar! <?php get_sidebar( ‘left’ ); ?> <?php get_sidebar( ‘right’ ); ?>
Have you tried: function my_members_only_shortcode($atts, $content = null) { if ( !is_user_logged_in() ) { $content=”<p>This content is for members only. Please log in or register first.</p>” . do_shortcode(‘[do_widget “Social Login” ]’); } return $content; } That should replace the content with your message and special short code content only if the user is not logged … Read more
I was having the exact same problem while querying post and pages, but also the jetpack-portfolio post type in my custom widgets. I was using $query = new WP_Query( $query_args ); in both cases. For me the fix was to change $query to $query_entries and $query_projects. It works as expected now. I see you’re already … Read more
you would need to create widget areas and new widgets http://codex.wordpress.org/Widgetizing_Themes
The main changes needed in order to use tags instead of categories would be: In section one, change… $args[‘category__in’] = $categories; to $args[‘tag__in’] = $categories; And in the second section, change the cats loop: $title = esc_attr($instance[‘title’]); $number_posts = (int) $instance[‘number_posts’]; $categories = (array) $instance[‘categories’]; echo ‘<p><label for=”‘ . $this->get_field_id(‘title’) . ‘”>’ . ‘Title: ‘ … Read more
I re-wrote the function, taking a few liberties with it. The main change was specify the ID of the association to link to in your call to get_permalink and to just use $association->ID instead of calling get_the_title (though you could just place the same ID in get the title). I also switched from using the_post() … Read more