Florette
Forum Replies Created
-
Forum: Themes and Templates
In reply to: Trouble to insert a custom sidebar in custom single post pageHi Paul!
That is well noticed but it didn’t change anything…
I actually found out that the closest I could move the <?get_sidebar(); ?> was under the <?php the_date(); ?>.
If I have put the <?get_sidebar(); ?> anywhere up this tag, it wouldn’t work.
It is probably because a contradiction between posts, I don’t know, but I feel that it is rather a problem of that origin…
So I end up doing a bit more coding in CSS with absolute positioning the sidebar, and it’s all good!
Maybe not the greatest fashion but the result is here. I will probably review my php code when I am better at it…I have just published the site, so if you are curious: chek at https://flavourista.net
The problem was occuring when you click on any “read more” button for the pages ‘Miam Recipes’ and ‘Small Talk’ -> They all lead to a single post page.Thank you soooo much for your help and sorry to bother… I hope I will be able to return the help one day!
Forum: Themes and Templates
In reply to: Trouble to insert a custom sidebar in custom single post pageHi Paul,
Thank you for helping me out!
I work locally so I am afraid I will have to provide only code :/Here is the page “blog” where the sidebar is working:
<?php /* Template Name: Blog homepage */ ?> <?php get_header(); ?> <div id="main_content"> <section> <div id="section1"> <aside> <?php get_sidebar(); ?> </aside> <div id="about_textsection1"> <h1><span class="green">Small</span> Talk (Blog)</h1> <?php include (TEMPLATEPATH . '/inc/nav.php' ); ?> <?php query_posts('showposts=4&cat=5');?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div <?php post_class() ?> id="post-<?php the_ID(); ?>"> <div class="recipe_img"><img src="<?php echo get_post_meta($post->ID, "recipe_image", true); ?>"></div> <!-- END about_img --> <h4> <?php the_title(); ?> </h4> <div class="entry"> <?php the_excerpt(); ?> </div> <div><a href="<?php the_permalink() ?>" title="read more" target="_self" class="black_buttonAboutpage">Read more</a></div> <div class="clear_left"></div> </div> <!-- END post --> <?php endwhile; ?> <?php include (TEMPLATEPATH . '/inc/nav.php' ); ?> <?php else : ?> <h2>Not Found</h2> <?php endif; ?> </div> <!-- END about_textsection1 --> <div id="about_textsection2"> <h1><span class="green">Enjoy</span> your cooking</h1> <p>At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias.</p> <p>Excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio.</p> <p> </p> <ul> <li><a href="https://flavourista.net/about.html" title="About me" target="_self">Read more about me and how I concieve cooking</a></li> <li><a href="https://flavourista.net/recipes.html" title="Miam recipes" target="_self">Without anymore wait, go to see my recipes</a></li> <li><a href="https://flavourista.net/blog.html" title="Small talk (blog)" target="_self">A little chitchat about cooking</a></li> <li><a href="https://flavourista.net/contact.html" title="Get in touch (contact me)" target="_self">I would love to hear from you so, don't hesitate to drop me a line</a></li> </ul> </div> <!-- END about_textsection2 --> <div class="clear"></div> </div> <!-- END section1 --> </section> </div> <!-- END main_content --> <?php get_footer(); ?>
And here the sidebar:
<aside> <div id="about_sidebar"> <div id="about_sidebar_title"> <h1>ChitChat</h1> </div> <!-- END about_sidebar_title --> <?php query_posts('showposts=4'); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div id="about_sidebar_content"> <p> <?php the_excerpt(); ?> </p> <p class="readmore"><a href="<?php the_permalink(); ?>">Read more...</a></p> <p class="posted">Posted on <?php the_date(); ?> </p> <?php endwhile; endif; ?> <?php get_search_form(); ?> </div> <!-- END about_sidebar_content --> </div> <!-- END about_sidebar --> <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('Sidebar Widgets')) : else : ?> <!-- All this stuff in here only shows up if you DON'T have any widgets active in this zone --> <?php endif; ?> </aside>
Flore