How to use loop on static page in wordpress? - wordpress

I want to loop posts form different category on static page. So , I have 5 static pages , and 5 different categories. I want to loop posts from one category per one page.
The way I do it is this:
> $novo = new WP_Query('cat=3'); // 3 is category id I want display
> while($novo->have_posts()) : $novo->the_post();
>
> <!-- post model -->
>
> endwhile;
The problem with this that I don't know how to display pagination in static pages with many posts in single category.
What's the best way to make loop on static pages with easy navigation implementation?
what you usually use to make loop on static page?
Any help is appreciated :D

First of all, the question is wrong. An static page is one that DOES NOT HAVE QUERIES or receive any kind of information from other sources.
If you want to paginate a single post wich has more than one page, you should use:
<?php wp_link_pages('before=<p>&after=</p>&next_or_number=number&pagelink=page %'); ?>
If you want to paginate a page wich have N posts:
wp_pagenavi():

Related

if condition for single.php at wordpress

Since I have a blog in blogger(it is a images blog), so I recently moved to wordpress.
After importing all posts from blogger to wordpress it is showing post thumbnail image in single post along with the post original image. So I changed the template. It good working for all imported posts.
But I posted many posts after came to wordpress using a plugin for bulk posting. That template showing thumbnail images in main page , category page etc.. But in single post it is not showing original image.
So I changed template again. Now the images are not showing in imported posts (single post).
So I decided to show separate single.php codes for each category.
So what I need is:
I gathers these 2 codes.
code 1:- (single.php of 1st template)
code 2:-(single.php of 2nd template)
Here I am copying these 2 codes.
In a template single.php code(what ever the template may be) I like to write if condition to solve my problem. I will tell you algorithm but please write the if condition code please. ............
Algorithm:
if( categeory_id=14 or 15 or 16 or 17)
Code 1 here.
else
code 2 here.
Thanks to all developers. If it is not possible please suggest me a good gallery theme.
Thanks in advance.
This should work:
<?php if (is_category( array( 14,15,16,17 ) ))
{
//Code here
}
else
{
//other code
}
?>
In the array put the id of the category. If a category isn't in that array then it will run the other code.

Remove title from static pages

On the site I'm working on I have two kind of pages:
A page containing posts from specific categories
Static pages
On the pages with categories I want the category name to show on top of the page, but on the static pages I don't want any title to show up at the top (other than the subject I choose when creating the page).
Category page:
Static page: <- "Blogg" shouldn't be there
So, how can I remove the title from static pages (always "blogg" which I don't know where it comes from)?
EDIT: I'm using a theme called "future" (http://wordpress.org/themes/future)
Change on page loop-meta.php.
Its coming from here.
Comment or remove this code
<?php //_e( 'Blog', 'future' ); ?>.

Wordpress pages theme/layout

I'd like to know whether I could have different layout and content for each page?
For example, I have 4 pages, and I have 4 completely different layout design, do I need to make 4 themes then apply to different pages or something else?
Moreover, can I have different posts show on different page?
like post no.1/or tag [google] goes to page 1, post no.5/tag[orange] goes to page 3?
I'd like to learn how to structure this idea.
Many thanks
make the diffrent template for different pages to show the different design on every page
for making template create normal php file and at the top of file add the code for every template by replacing template name
<?php
/*
Template Name:About Us
*/
?>
By this you get different template for about us put you code desing that you want to show for this page and from that back end select the template from rignt hand side option and save that page .
And to show different post on different pages you need to create category after that where you want to call the post for page call the category code for that
<?php Query_post('cat=3&showposts');
while(have_posts()): the_post();
the_title();
endwhile; wp_reset_query(); ?> every time on different page you just chage the category id (cat)

Wordpress Categories Linking to Subcategories

I'm trying to accomplish a three-step page hierarchy in Wordpress.
Here's an example of what a breadcrumb navigation might look like:
Mathematics > Algebra > Variables
I've got a page that lists all of my top-level categories:
<?php wp_list_categories('depth=1'); ?>
What I need next is to make it so when you click a category, it links you to a page that just lists all of its subcategories. By default it takes you to a page with every post in that category.
So you could select say Math on the first page, followed by a page with sub-categories like Arithmetic, Algebra, Geometry, and then when you select your sub-cat it takes you to the posts.
I'm open to using any alternative methods too if you've any ideas on a better way to do it. Using the built-in category system just seemed most appropriate.
wp_list_categories can take an argument, 'child_of', that will return a list of child categories. So, in your individual category listing page, you can use the category id of the relevant category to retrieve the children like this:
<?php $children = wp_list_categories('child_of='.$your_category->cat_ID); ?>
Further documentation for wp_list_categories can be found here: http://codex.wordpress.org/Template_Tags/wp_list_categories

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