Cum pot creea un sidebar "special" care sa il pot afisa doar pe anumite pagini a unui site?
Multumesc
Versiune printabilă
Cum pot creea un sidebar "special" care sa il pot afisa doar pe anumite pagini a unui site?
Multumesc
Pentru wordpress?
In wordpress admin te uiti la ce id are pagina ta, sa zicem ca pagina ta are id-ul 8.
Pe urma ai asa : page-8.php : in pagina asta pui urmatorul cod :
Pe urma faci o pagina sidebar.php si scrii codul css al site-barului tau....Citat:
<?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 gridsby
*/
get_header(); ?>
<div class="grid grid-pad">
<div class="col-9-12 content-wrapper">
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'page' ); ?>
<?php
// If comments are open or we have at least one comment, load up the comment template
if ( comments_open() || '0' != get_comments_number() ) :
comments_template();
endif;
?>
<?php endwhile; // end of the loop. ?>
</main><!-- #main -->
</div><!-- #primary -->
</div>
<?php get_sidebar(); ?>
</div>
<?php get_footer(); ?>
Acolo unde vrei sa iti apara sitebar-ul tau incluzi : <?php get_sidebar(); ?>
Sau si mai simplu, foloseste pluginul custom sidebar.
Nu stiam daca a raspuns cineva, chiar acum vroiam sa postez, ca am gasit custom sidebar si l-am ales pe el, e foarte usor de folosit mai ales ca nu stiu programare: https://wordpress.org/plugins/custom-sidebars/