Hello everyone ! I hope you could help me with something thats really over my head at this point.
I have a template I am using from rocket theme - well my problem is there is two types of pages on this template that each use different widget positions. 1. the front page 2. Every other page.
You can see how the widget positions are set up by clicking below.
http://demo.rockettheme.com/wordpress/wp_novus/widgets/
What I want to do is make it so all the pages have some or all of the widgets that display on the Front page. USER 1 for instance we want on every page.
Can someone tell me how I could change these ? Your help would be appreciated.
Colin Pool answers:
Change the following code in every PHP file like index.php, page.php, archive.php, page-blog.php, page-cms.php and single.php
<?php if(is_front_page() && is_active_sidebar('user_1')) { ?>
<!-- Begin User 1 Widget Position -->
<div id="top">
<div class="moduletable">
<?php dynamic_sidebar('User 1'); ?>
</div>
</div>
<!-- End User 1 Widget Position -->
<?php } ?>
into the following code:
<!-- Begin User 1 Widget Position -->
<div id="top">
<div class="moduletable">
<?php dynamic_sidebar('User 1'); ?>
</div>
</div>
<!-- End User 1 Widget Position -->
The code you delete tells the server to put the User 1 widget only on the front page. If you delete this rule, you see the widget is displayed on every page. You can do this with every widget you want to display on all pages.
To show User 4 on every page, just paste the following code into page.php and single.php:
<!-- Begin User 4 Widget -->
<div class="block">
<div class="moduletable">
<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('User 4')) : ?>
<ul id="mainlevel-nav">
<?php wp_list_bookmarks('title_li=&orderby='.$option['blog_blogroll_order'].'&limit='.$option['blog_blogroll_limit'].'&link_before=<span>&link_after=</span>&categorize=0&category='.$option['blog_blogroll_category']); ?>
</ul>
<?php endif; ?>
</div>
</div>
<!-- End User 4 Widget -->
You've to put the code after this code:
<?php else : ?>
<span class="attention"><?php _re('Sorry, no posts matched your criteria.'); ?></span>
<?php endif; ?>
To show User 3 on every page you have to do the same as for User 1. Change the following code in every PHP file like index.php, page.php, archive.php, page-blog.php, page-cms.php and single.php:
<!-- End User 1 Widget Position -->
<?php if(is_front_page() && ($option['blog_recent'] == 'true' || $option['blog_popular'] == 'true' || is_active_sidebar('user_2') || is_active_sidebar('user_3'))) { ?>
<!-- Begin User 2 And User 3 Widget Positions -->
into:
<!-- End User 1 Widget Position -->
<!-- Begin User 2 And User 3 Widget Positions -->
and:
<!-- End User 2 And User 3 Widget Positions -->
<?php } ?>
<div class="contentpadding">
<div class="blog custom-page">
into:
<!-- End User 2 And User 3 Widget Positions -->
<div class="contentpadding">
<div class="blog custom-page">
pedu blain comments:
So for how would that work to have User 4 and User 5 on every page?
what would be the code for that ?
Colin Pool comments:
<blockquote>Test</blockquote>
pedu blain comments:
dude contact me if you can !
Jason Pelker answers:
Use the Widget Logic plugin: http://wordpress.org/extend/plugins/widget-logic/ and then use the conditional tag "is_front_page()" on any widgets you want only on the front page.