Wordpress Themes - WP Forum at BFA
Click Here To DONATE! Support the theme development, get more attention and additional benefits based on your donation level. Your forum name will be highlighted.

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Center area post/pages »

Supercharge your Atahualpa: show any combination of pages and posts you like.


Build custom WP THEMES, without
coding.
Click here for THEMEFRAME

From the author of Atahualpa, the #1 most
downloaded (700,000+) theme @ wordpress.org
 
Prev Previous Post   Next Post Next
  #1  
Old Nov 22, 2010, 07:13 PM
STB
 
764 posts · Apr 2010
Supercharge your Atahualpa: show any combination of pages and posts you like.

Template updated to v1.4 , per june 17, 2011



Supercharge your Atahualpa WordPress site.

This template is my first attempt in learning some about php, and about the inner working of
Wordpress and Atahualpa. I am proud to say I think I have come up with something very versatile.



This template:
  1. Let’s you combine any static page info with any posts of your choice
  2. Has fully working pagination (links for next/previous posts) anywhere on your site
    (this template finally solves the pagination problem)
  3. Lets you choose to use the “read more” tag or not
  4. Let’s you choose to show “no content found” or not
  5. Has fully working support for excerpts
    (either manual excerpts or automatic cutoff after X words, as defined under Atahualpa -> Posts and Pages -> Configure Excerpts)


    And a bit more technically … for the “tech savvy”:

  6. If you have more people writing on your blog, this template allows you to let other people edit the static page info, but disallow them to change the posts .. or vice versa.
  7. This template stores the static page info in a global variable. You can use it elsewhere on your page. You can for example retrieve the page author, and have “page author related content” in your sidebar.



Background info
Normally in WordPress you can have
- 1 blogpage with latest post that can’t have any static content.
- all other static pages, that don’t have your posts.

This template lets you have both, and on any page you choose. By using this template, you can turn any page into a page that has the page's 'static page' on top and 'dynamic content with posts of your choice' underneath. You can do this for as many pages you want, and have each page show different static content and different dynamic posts.




How to use?
  1. Upload "STBs_Supercharge_Atahualpa3xx_Template_v1_4.php” to your Atahualpa theme directory
  2. Edit the page you want to use it on
  3. Under “Page Atributes”, set template to: “STB's Supercharge v1.4 for Ata 3.xx
  4. Edit the static page content as you normally would
  5. Define the posts you want to show up underneath your static content, as explained below.


Define which posts to show under the static page content
  1. While still editing the page, go to the "Add Custom Field" box on the editscreen.
    (Since Wordpress 3.1, this box is hidden by default.
    To show it: click "Screen Options" on top of the screen, and select "Custom Fields")
  2. Give the custom field the name: “custom_query”
  3. Give it a value as explained below
  4. Finally, after you have entered the name and value, don't forget to click the "Add Custom Field" button.


How to the show posts you want to show?
(or .. what to use for “value” in the “custom query field”)
WordPress has a powerfull built-in function called “query_posts()”.
It lets you fetch any list of posts, any type of posts, by any author, in any category, within any daterange etc. etc.

This template lets you fetch these post, by just defining the value for the function.
No further coding needed.

I will give some examples further on, but for a full list of options, see these two pages from the WordPress Codex:
- http://codex.wordpress.org/Function_...ce/query_posts
- http://codex.wordpress.org/Function_...ery#Parameters
This template lets you use all of the values explained on those pages.



Some examples for Custom Field:
Remember, you can use about any combination here, to show whichever posts in whichever order you want.
For full explanation, read the wordpress page (and if you don't understand it, please read it again, it is explained very well there.)
These are just a few examples to get you going:


1) If you want to show:
- All normal “posts”
- that are published (that means, not drafts, and not private posts)
- with the default “posts per page”
(as defined in wordpress admin panel -> Settings -> Reading)

You should use this value for “custom_query”:
Code:
post_status=publish

2) If you want to show:
- published posts
- in the category “news”
- and want to show 10 posts per page

You should use this value for “custom_query”:
Code:
post_status=publish&category_name=news&posts_per_page=10
3) If you want to show:
- published posts
- of the post type “podcast” (providing you have defined such custom post type)
- alphabetically ordered by the name of the “author”
- show 5 posts per page

You should use this value for “custom_query”:
Code:
post_status=publish&post_type=podcast&orderby=author&posts_per_page=5


Category names longer than 1 word:
WordPress has a problem to understand category names that are longer than 1 word.
In other words .... you can not use spaces in category names in this template.

For example:
If you want to show the posts in your category: “my bookreviews” .. then this will NOT(!) work:
category_name=my bookreviews&post_status=publish&posts_per_page=10

Instead you should:
  • look up the category number and use that.
    (WordPress admin panel -> Posts -> Categories, then hoover your mouse over the category, and find the ID in your browsers statusbar. Do note that since Wordpress 3.1, the category ID shows up as "tag_ID=x" in the statusbar.)
    If category "my bookreviews" would be category number: 8
    you would use: "cat=8&post_status=publish&posts_per_page=10"
  • Or you could rename your categoryname, for example rename “my bookreviews” to “my_bookreviews” or “mybookreviews” or just simply “bookreviews”




This is basically all you need to know to get going.
If you want to know more, read on in the next post…





Downloads:
For Atahualpa 3.5.3 and lower, use "STBs_Supercharge_Atahualpa35_Template_v1_4.zi p"
For Atahualpa 3.6, 3.6.1 and 3.6.4 use "STBs_Supercharge_Atahualpa364_Template_v1_4.z ip"
For Atahualpa 3.6.7 use "STBs_Supercharge_Atahualpa367_Template_v1_4.z ip"

Version history:
Update for Atahualpa 3.6 (january 7th, 2011)
Update for Atahualpa 3.6, version 1.1 (january 30, 2011)
Updated both 3.5 and 3.6 templates to version 1.2 (february 5, 2011)
Updated both 3.5 and 3.6 templates to version 1.3 + added another explanatory link above (march 14, 2011)
Updated templates to version 1.4 (fix for rare bug in right sidebar) + added template for Atahualpa 3.6.7 (june 17, 2011)

Thanks to Alexander for helping making the template compatible with Atahualpa 3.6.

Last edited by STB; Sep 8, 2011 at 01:54 AM. Reason: updated
 

Bookmarks

Tags
add custom field, custom query

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Show sticky posts in category pages c32v Atahualpa 3 Wordpress theme 4 Dec 12, 2010 08:37 AM
BUGFIX 351/352-01: EXCERPTS - Show first X posts on HOME page as full posts juggledad Old Version fixes and change logs 1 Jul 13, 2010 05:42 AM
[SOLVED] How can I get more posts to show up on archive/category pages? cowgrrrl Excerpts, Read more, Pagination 6 Jun 26, 2010 11:10 AM
[SOLVED] 3.5.1 Bug? Show the first X posts on HOME page as full posts - not working Fux Excerpts, Read more, Pagination 6 May 30, 2010 01:59 AM
[SOLVED] New Installation-Pages show posts instead of installed images, etc. casahac Center area post/pages 8 Mar 31, 2010 08:36 PM


All times are GMT -6. The time now is 04:39 PM.


Powered by vBulletin® Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.