Forums
Forums / Fixing WordPress / add a page to sidebar
(@solidcolour)
15 years, 9 months ago
So I have a page called “latest news” and using a custom template t_latest_news.php
<?php /* Template Name: Latest News */ ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class=”latest-news” id=”post-<?php the_ID(); ?>”> <?php the_content(); ?> <?php edit_post_link(‘Edit this page’,'<p class=”edit-link”>’,'</p>’); ?> </div><!– /.latest-news –> <?php endwhile; endif; ?>
I’ve created a page item and put some content into that page. Now, I want to show the content on the sidebar. How can I do that please?
I’ve tried something like: <?php include(get_query_template(‘t_latest_news.php’)); ?> <?php include(TEMPLATEPATH . ‘t_latest_news.php’); ?> <?php get_query_template(‘t_latest_news.php’) ?> <?php get_template_part( ‘t_latest_news.php’ ); ?>
But none of them works. HELP!
(@numeeja)
Unless I’ve misunderstood your aim, and as long as you have a widgetised theme, it sounds like the Spectacu.la Page Widget plugin will enable you to do what you want to achieve: http://wordpress.org/extend/plugins/spectacula-page-widget/
It might work. But I’d have to do it without the plugin. Basically, include a template and it’s content into sidebar.php.
Thanks!
The topic ‘add a page to sidebar’ is closed to new replies.