Issue
- how to write code and where (like in page.php or function.php or else )for calling sidebar in a specific page like shop page or about me page or 404 error page or else.
- if you want to check theme file whats missing code causing not appearing sidebar in any pages ,specially in shop page. ,here is the type of file available in my theme file (
).
- I am asking this question because in post type page and in single product pages only the sidebar is showing in but not showing in any of the page type pages like in shop page or about me page or 404 error page or home page like that.(
,
,
,
).
- I tried many possible efforts but didn't figure out how to get a sidebar on a specific page.
- i also tried this code in page.php but didnt shown sidebar in any page.
<?php if($enable_sidebar) get_sidebar(); ?>
- so, i need help . it will be appreciate
Solution
Answer : To make sidebar appear in specific page like shop page or about me page or 404 error page or else.
step 1: check what type of page is actually shop page is , is it page type or post type ().
step 2: once you found type of page like shop page is page type then go to page.php from appearance/theme editor/ page.php . and write this code between '< / div > < ! - - / # content - - >' code'< / div > ' .
</div> <!--/#content-->
<?php if ( is_shop() ) :
get_sidebar( 'shop' );
endif;
?>
</div> <!-- .row -->
this will appear sidebar in shop page only here simply change name of page in code to show sidebar in that named page . ()
extra 1 : if you want to show in some multiple other pages you can use this code .(
</div> <!--/#content-->
<?php if ( is_page (array(42,'about-me','Contact') ) );
endif;
?>
</div> <!-- .row -->
)
extra 2 : : if sidebar appearing below content not in side then you should use 'class row ' and put code at before end of row div. it auto make two colum one for content left and one for sidebar right so that it will auto align sidebar in side of content.().
Answered By - ank
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.