Welcome! To use this support forum, please Login or Join Today!

   

Sidebar does not show on pages

{name}
Rank

Total Posts: 12

Joined 2011-12-11

PM

 

The sidebar appears as expected on the latest posts list, individual posts and categories. However, I am unable to make the sidebar appear on the different pages I create, even if it has been set in Appearance > Theme Options, as well us in the Page Layout Options/Sidebar Layout during the editing of individual pages.

Do you have any suggestions? Thank you very much for any help!

{name}
RankRankRankRank

Total Posts: 3667

Joined 2011-04-27

PM

 

Are you referring to Pages or Posts? Normally, posts are used for blog content while pages are static or standalone content.

For this reason, there are two sidebar positions for various content types:

Left Sidebar - Posts
Left Sidebar - Pages

and

Right Sidebar - Posts
Right Sidebar - Pages


I also highly recommend the Dynamic Widgets plugin for showing/hiding specific widgets on a per-page basis.

 

{name}
Rank

Total Posts: 12

Joined 2011-12-11

PM

 

My client wants the sidebar to show for both posts AND pages. However, it doesn’t show in the pages even if I select left or right sidebar during editing.

I will try the plugin. Thanks!

{name}
RankRankRankRank

Total Posts: 3667

Joined 2011-04-27

PM

 

In order to show the same widget on both Posts and Pages, you’ll need to edit either page.php or single.php.

page.php is the template for single pages
single.php is the template for single posts

It sounds like you’ve already set up most of your widgets under “Posts” so you could edit page.php to include the post widgets if you like.

Change:

<?php
// st_0=Left, st_1=Right, st_2=Both, st_3=Wide
if ($colstyle == ("left") || $colstyle == ("leftright")) :?>
<?php LeftSidebarGrid($contentgrid,$leftsidebargrid,$rightsidebargrid,&$colorder,&$colstyle);?>
 <div class="sidebar left">
<?php if (is_active_sidebar('primary-page-widget') ) {
    dynamic_sidebar('primary-page-widget');
  } else {
    get_sidebar();
  };
  ?>
 </div><!--/sidebar-->
</div><!--/SidebarGrid-->
<?php endif; ?>

<?php
// st_0=Left, st_1=Right, st_2=Both, st_3=Wide
if ($colstyle == ("right") || $colstyle == ("leftright")) :?>
<?php RightSidebarGrid($contentgrid,$leftsidebargrid,$rightsidebargrid,&$colorder,&$colstyle);?>
 <div class="sidebar right">
<?php if (is_active_sidebar('secondary-page-widget') ) {
    dynamic_sidebar('secondary-page-widget');
  } else {
    get_sidebar();
  };
  ?>
 ><!--/sidebar-->

to:

<?php
// st_0=Left, st_1=Right, st_2=Both, st_3=Wide
if ($colstyle == ("left") || $colstyle == ("leftright")) :?>
<?php LeftSidebarGrid($contentgrid,$leftsidebargrid,$rightsidebargrid,&$colorder,&$colstyle);?>
 <div class="sidebar left">
<?php if (is_active_sidebar('primary-post-widget') ) {
    dynamic_sidebar('primary-post-widget');
  } else {
    get_sidebar();
  };
  ?>
 </div><!--/sidebar-->
</div><!--/SidebarGrid-->
<?php endif; ?>

<?php
// st_0=Left, st_1=Right, st_2=Both, st_3=Wide
if ($colstyle == ("right") || $colstyle == ("leftright")) :?>
<?php RightSidebarGrid($contentgrid,$leftsidebargrid,$rightsidebargrid,&$colorder,&$colstyle);?>
 <div class="sidebar right">
<?php if (is_active_sidebar('secondary-post-widget') ) {
    dynamic_sidebar('secondary-post-widget');
  } else {
    get_sidebar();
  };
  ?>


Essentially you’re just replacing primary-page-widget with primary-post-widget and the same for secondary.

 

{name}
Rank

Total Posts: 12

Joined 2011-12-11

PM

 

I’m not sure what I’m missing, but the page.php code looks different:

<?php
/**
* The template for displaying all pages.
*
* This is the template that displays all pages by default.
* Please note that this is the wordpress construct of pages
* and that other ‘pages’ on your wordpress site will use a
* different template.
*
* @package WordPress
* @subpackage smpl
* @since smpl 0.1
*/
// You can override via functions.php conditionals or define:
// $columns = ‘four’;

get_header();

st_content_wrap($columns);

get_template_part( ‘/loops/loop’, ‘page’ );

st_content_wrap_close();

get_sidebar(‘page’);

get_footer();

?>

Also, I did a recursive search from the blog root but I could not find any file that contained the string “primary-page-widget”.

Appreciate any suggestions. Thanks!

{name}
RankRankRankRank

Total Posts: 3667

Joined 2011-04-27

PM

 

Are you sure you’re using the Presstige theme? That doesn’t at all look like the code.

{name}
Rank

Total Posts: 12

Joined 2011-12-11

PM

 

I am terribly sorry! What was I thinking?

I am using the Element theme. Should I start a separate thread or can you move this discussion to the Element group?

Thanks!

{name}
RankRankRankRank

Total Posts: 3667

Joined 2011-04-27

PM

 

I have moved the topic to the Element forum. Are you using the child theme or parent theme?

{name}
Rank

Total Posts: 12

Joined 2011-12-11

PM

 

Child theme, style 3.

{name}
RankRankRankRank

Total Posts: 3667

Joined 2011-04-27

PM

 

You’ll need to do two things.


First, create a file named page.php in your child theme directory with the following contents:
http://pastebin.com/0qiPaXeV

Next, add this to your child theme’s functions.php:
http://pastebin.com/eJtNg994

Note, this renders the Pages Widget Area unusable.

{name}
Rank

Total Posts: 12

Joined 2011-12-11

PM

 

Thank you, sir!