Wordpress - how to show just posts on main index - wordpress

I have a Wordpress theme that I've been making 'my own' visually and can't seem to get the main content section to display regular posts only - instead of the boxes.
Does anyone know how I can change this without messing it up completely? I've tried stripping everything away and replacing with the 'display all posts loop' thing, but no go. I've tried adding a new page and setting that to show posts and such, but that didn't work either ... all it did was show the latest post.
Any ideas?
Thanks, Jennifer

It depends on what theme you are editing to make your own. If you were editing the default theme one way to do it would be to open index.php, define the template name with something like:
<?php
/*
Template Name: home
*/
?>
and then save it as home.php. In your admin Reading settings set that as your home page.
I am not sure what you mean by "boxes" but I assume you are not interested in the sidebar?
In this file there is one main loop running and it is set to retrieve only the latest post and a sidebar. It pulls in the title of that post : the_title(); the content : the_content(); and the sidebar get_sidebar();. What do you mean by "regular posts"? If you wanted the home page to pull a selection of latest posts you would create your own loop using WP_Query.. something like :
<?php $the_query = new WP_Query('cat=3&showposts=5');
while ($the_query->have_posts()) : $the_query->the_post();?>
Where you are interested in defining the category id (3) and the number of posts to show (5). You can read more on creating these kind of loops here
http://codex.wordpress.org/Template_Tags/query_posts
Good luck :)

Related

Wordpress adding thumbnails to category

How to take on a problem in WordPress admin editing.
I'd like to edit an edit-category admin panel to add a featured image to it (just like in posts), but I'm a bit indecisive since a lot of people use a custom field with static path to a photo, but I'm wondering is there a way to do it better(enable some wp hook and such).
Can someone point me in the right direction?
Thanks for the plugin it seems good, but i have one additional problem. It seems i have a lack of knowledge on how to query an object [category] so i can apply filters, hope im making some sense. This is done on my home.php. all dumps are null
<?php get_header();
$listcat = get_categories('hide_empty=0');
foreach($listcat as $x){
$img = apply_filters( 'taxonomy-images-queried-term-image', '');
var_dump($img);
}
get_footer(); ?>
The same code works with no problems if i stick it in category.php. Any ideas? :)
i've used several times the plugin "Taxonomy Images". it works with multi-language wp installs too.
link with instruction: http://wordpress.mfields.org/plugins/taxonomy-images/

Wordpress ignoring page template from drop down

I am struggling with something that appears to be easy, page templates. I have read plently posts on this, people seem to forget to put the comment at the top of the page and can't get it to show up in the drop down menu on pages. I can do this, my problem is the next stage.
I have written the most basic template (custom-page.php):
<?php
/*
Template Name: Test template
*/
?>
<?php get_header(); ?>
<h1>Teams!</h1>
<?php get_footer(); ?>
It shows up and I can select it on the new page sidebar. However when I visit that new page it seems to have defaulted the archive page using the content template include.
Thanks in advance.
If you put the following in your footer, you should be able to grok some further information about how your template is being selected (and know exactly what might be happening).
<?php global $template;
echo(basename($template)); ?>
Then look for the template name in your footer. It's possible (like #adomnom said) that you have a slug conflict. There are a handful of other strange scenarios that could be caused by plugins, custom functions, or other factors as well.
By the sounds of things, it could be conflicting with another template.
For example, if your page has the slug 'category' and is set to use the custom template 'custom-template.php', it would conflict with (and be overridden by) category.php, which is the default template for showing posts for a specific category.
I recommend changing the slug to see if that's the problem.

Adding A Button Between post-content and Related Posts Thumbnail Plugin on WordPress

I am trying to add a button to my WordPress template. Basically, I have the post and then there is the Related Posts Thumbnails widget that appears. I want the button to go between the text of the post and the related posts thumbnail widget. The code in my 'Single Post' that contains all of this is as follows:
<div class="post-content">
<?php the_content(__('<em><strong>More:</strong> Read the rest of this entry...</em>', 'life-is-simple')); ?>
</div>
I know the Related Posts Thumbnails plugin falls within this code because it's at that place when I 'Inspect Element' on Google Chrome. I can't find how to edit the order of things within that div though. Any help would be greatly appreciated, thanks!
EDIT
Clarification: I am using the Life Is Simple WordPress theme although it has been custom editing quite a bit (mostly on the CSS side of things though).
That plugin is probably appending the output to the_content with a filter .
That means , that the output is being added to the_content automatically. it is a common behaviour.
You need to look at the pluginĀ“s admin interface to see if you can have an alternative way (I believe there is ) which is using a template tag. in that case, you should put the template tag after the div where the the_content() is .
EDIT I :
After a small dig, - in fact there is - you need to put
<?php get_related_posts_thumbnails(); ?>
Then the plugin should know by itself not to append to the_content.
For parameter passing, or if something is not working, go read their APi or help files.
You'll probably need to edit single.php or archive.php in your theme. If nothing is occuring there that looks familiar, it's probably using a loop. In which case you might find what you are looking for either in loop.php, loop-single.php, or loop-archive.php depending on what type of page you are on and how the theme was constructed. Add your button near where you find Read the rest of this entry...
With more information (such as what theme you are using), one might be able to help more as well.

WordPress--post only latest 1 or 2 or 3 posts on homepage

How do I just display the latest post on home (not the whole archive as wp does by default)?
And how can I influence that it has/not date, category, read more, etc?
WP manual does not explain this clearly. Or does it? If yes, please tell me where?
Thank you guys! And girls!
The new Wordpress Themes have child themes, it is a new way to organize and simplify upgrading themes, but it can be a pain because they are not as easy to modify as older themes. Anyway, there is the old way:
You can use the settings in the Administration Page to set your homepage to display only one post (Settings / Reading / Blog pages show at most -> 1 post). But if you want just your home to display one post, and decide you want your archives to display the basic 10 posts, you can edit your theme template to use this function:
<?php query_posts('posts_per_page=1'); ?>
Function Reference/query posts
http://codex.wordpress.org/Function_Reference/query_posts
To be sure no date or category is displayed, you also have to edit the template and remove the corresponding php code (in the loop, you should look for these functions:
<?php the_category(); ?>
<?php the_date(); ?>
Function Reference/the category
http://codex.wordpress.org/Function_Reference/the_category
Function Reference/the date
http://codex.wordpress.org/Function_Reference/the_date
To use the new way, you have to create a child theme to your theme, and override the loop by creating your own loop.
Chld Themes
http://codex.wordpress.org/Child_Themes

Wordpress multiple / exclusive posting pages

I want a site with a separate News and Blog page, ie only news posts are dispayed on news pages and non news posts on blog pages. Also archive lists, category lists, etc for each page must only display relevant posts. Seems like a common requirement, but using the WP documentation, I keep going around in circles!!! Is there a simple way to do this, without getting into multiple blogs, eg using categories.
Thanks
That's easy.
First, you will need to create custom page template. Refer to this page to see how to create it.
Second, on that page (you can copy from your page.php/index.php, the important part is:
if (have_posts()) : while (have_posts()) : the_post();
Find that piece and add this code just right above that code:
query_posts('cat=3&paged='.get_query_var( 'paged' ));
Things to note from above query_posts snippet is:
cat: this is the category ID you want to query. To easily see what ID is on a particular category, you can use ShowID for Post/Page/Category/Tag/Comment plugin.
paged: Paged will allow your custom page to handle next & prev navigations, which is handled by next_post_link() and prev_post_link(). As for get_query_var( 'paged' ) is function to get what page's page you currently see.
Hope that helped.
<shamelessplug>
I blogged it here (in Bahasa Indonesia, which you can easily translate using google translate).
</shamelessplug>

Resources