Page with SideBar
-
Hi,
I need a help from you.. The default front page of wordpress will be the list of articles with sidebar. My requirement is to list all (list of 5 or 10 depends from the settings) the articles (as in index page) in a new page where it shouldn’t have sidebar linked to it. How can I achieve this?
-
Answer: custom page templates
https://www.google.com/search?q=wordpress+custom+page+templates
Ok I’ll provide some more detail.
Check my website in the link https://sql-articles.com/blogs/articles/
I need to remove sidebar in that page. I’m not a PHP developer, so can someone please help me to remove the sidebar.
All other pages I’ve corrected it. In this article page I’ve selected static page option under reading setting and change the posts page to article.
I believe the following is a reasonable way of achieving this:
Go to your themes directory (usually located at your-blog-home/wp-content/themes/mytheme/).
Open (for example) the index.php file.
Search for the text “get_sidebar”. It’ll be in a line that looks like this, usually –
<?php get_sidebar(); ?>
Edit that to:
<?php //get_sidebar(); ?>
And you should be on your way to removing the sidebar from your pages. You can repeat this act on single.php, page.php, and so on.
Good luck!
I couldnt find the function in any of the file mentioned under themes folder. Can you check the theme, its located @ https://www.ads-software.com/extend/themes/inove
I’ve tried the below PHP query, but its not displaying anything.
<?php if (have_posts()) : the_post(); update_post_caches($posts); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><?php the_title(); ?></h2> <div class="info"> <span class="date"><?php the_modified_time(__('F jS, Y', 'inove')); ?></span> <div class="act"> <?php if ($comments || comments_open()) : ?> <span class="comments"><a href="#comments"><?php _e('Goto comments', 'inove'); ?></a></span> <span class="addcomment"><a href="#respond"><?php _e('Leave a comment', 'inove'); ?></a></span> <?php endif; ?> <?php edit_post_link(__('Edit', 'inove'), '<span class="editpost">', '</span>'); ?> <div class="fixed"></div> </div> <div class="fixed"></div> </div> <div class="content"> <?php the_content(); ?> <div class="fixed"></div> </div> </div> <?php else : ?> <div class="errorbox"> <?php _e('Sorry, no posts matched your criteria.', 'inove'); ?> </div> <?php endif; ?> <?php include('comments.php'); ?>
Okay, I haven’t really seen the theme’s code before so I am not sure how well this will work.
Try opening footer.php. It looks like this:
</div> <!-- main END --> <?php get_sidebar(); ?> <div class="fixed"></div> </div> <!-- content END --> <?php include('templates/end.php'); ?>
So the deal is that the footer is called by (almost*) every other file in the template, so the sidebar will always load. So replace that line (the fourth one in this particular file) with:
<?php //get_sidebar(); ?>
And this should very likely work.
Good luck ??
*There’s a page-without-sidebar.php (or something to that effect) that does not call the footer at all.
Thanks, this worked but the div is still there.
You are right, I’ve used page without side bar template. However I dont know how to display only posts (without sidebar). I.e I dont know the query to be used to get only post content.
Can you link me to a blog where you have modified the theme? Do you mean that the sidebar contents have disappeared and an empty div is loading? That shouldn’t really happen unless I’m missing something pretty obvious… I think it’ll be easier if I get to see an example page with the footer.php file modified as I suggested.
Below is the footer content
</div> <!-- main END --> <?php //get_sidebar(); ?> <div class="fixed"></div> </div> <!-- content END --> <?php include('templates/end.php'); ?>
You can preview it in the link https://sql-articles.com/blogs/articles/
Ok, it’s a little more work than I thought.
Try the following steps now:
Get the file style.css and the new header image. Backup the style.css and header_footer.jpg files on your server. Assuming* you have not changed style.css at all from the template, replace it with the file that you have downloaded. Go into the img/ directory inside your theme and replace the header_footer.jpg file with the one that you have downloaded.
This should fix it, as far as I can see… I look forward to seeing the results on your server.
*If you have tweaked the style.css file, let me know, and I’ll describe the changes you need to make, they are quite simple.
Thanks.. Right now I’m in office, I wont be able to upload the image file. Will check it and provide you the result some time later.
Sure, good luck ??
Thanks a lot. This worked for me.
I need one more help. Can I get the query to fetch the posts and its content (i.e in my website i need articles alone) as shown in articles page.You’re most welcome.
I’m not sure I understand your new question, do you think you can explain again? :S Sorry!And you may want to mark this thread [resolved], if you opened it as a support question. Cheers!
Hi..
I need the PHP code used to get the details of articles title and its content. You can find in the articles page in the website.
My requirement is that .. I need sidebar in Home page and side bar is not needed in articles page. When I implement the script given by you its perfectly removing the side bar from the entire theme (also from the home page ) but I need it in the home page. So i thought of creating a page template to fetch the details of articles titles and content (as in article page) and use this in a page.
I’ve copied some codes from index.php, but this is not working. Any ideas?
Thanks Again
Thanks a lot avanimisra….
I’ve made some changes and got the final result..Thanks again ??
- The topic ‘Page with SideBar’ is closed to new replies.