Change number of posts to display - wordpress

How do I tell Wordpress to change the number of posts to display depending on the type of page being shown? For example, all Search results will show 10 posts at a time while Archives will show 20 posts at a time, etc.

what you have to do is to deal with the query_post() function.
See this codex page : http://codex.wordpress.org/Function_Reference/query_posts
You will then have to modify your archive.php and search.php files (depending on your theme) to call this function right before the loop.
All is described in a pretty simple example here
Hope this will help ;)

This should be moved to https://wordpress.stackexchange.com/
There is 1 global setting (settings->reading)
If you want to change individual settings you will have to adjust your theme.
put query_posts('post_per_page=XX') before the loop also look at: query_posts

No need to deal with custom queries and changing page templates. Try WordPress › Custom Post Limits « WordPress Plugins
Update 3/06/2015; Plugin works fine under WP 4.1

Related

Issue with using [display-posts] shortcode on Wordpress

I am having an issue finding any way to display a single post on the woocommerce checkout specifically on a payment plugin, I use other shortcodes in these gateways and they work perfectly.
However when I try using some display post shortcodes it doesn’t work at all and instead shows up as text.
Example of my issue - i edit and put in the shortcode [display-posts] and instead of displaying the posts it simply displays [display-posts].
I have tried using multiple shortcode plugins and even tried creating my own. The main one I have tried to use is [display-posts] with the plug-in. I always put it in my themes functions.php as well!
I have tried these short codes on the regular Wordpress pages that I have that are published and have found I have the same issue, so I don’t believe it’s the placement I want the shortcode to appear at. Can anyone help me with this?
To make all the posts display you can create a custom shortcode and the shortcode which you are using is [display-posts] is not default WordPress in build shortcode. To have your same shortcode run please install the below plugin: https://wordpress.org/plugins/display-posts-shortcode/
Then you [display-posts] shortcode will work or another solution is custom shortcode as I mentioned above.
Please let me know if find any issues.
Thanks.

displaying pages containing wordpress shortcode

I wrote a shortcode for wordpress to display wordpress posts and pages. Displaying posts is fine but when I try to display pages, it goes on infinitely. I guess one of the pages contains the shortcode and hence it displays recursively. Can anyone suggest me the solution for this. As to how I can prevent short code from being executed while displaying ?
not totally sure if I understand correctly. Maybe you just need to have the shortcode run not from a page but in a template php file.
http://codex.wordpress.org/Function_Reference/do_shortcode
otherwise you will need to exclude that page from being displayed in your shortcode manually, is it a plugin you are working with?

Wordpress Gallery

This website is based on wordpress, I wonder which plugin/theme are they using to customize wordpress into a gallery/download site.
Many thanks for your help!
I think you can do this with WordPress' thumbnail feature. You can assign a thumbnail to each post. It looks like that, and some tweaking to the theme in the way the posts are displayed and the download button is included.
Maybe there's a plugin to assign a file to download on each post, that's the only part I find complex in this theme.
Check these links:
http://www.wpzoom.com/design/10-wordpress-themes-designed-for-photo-galleries/
http://wordpress.org/extend/plugins/search.php?q=download

Post pages in Wordpress 2.9

I'm trying to use a posts page in Wordpress. For the uninitiated, this is a page (other than the home page) which features all your blog posts. You essentially turn on the static home page and point Wordpress at a custom index. Then you tell Wordpress to use another custom template as your "posts page"; thereafter, any post you make will wind up there.
My custom template for the 'Blog' page shows up as expected until I define it as the posts page. When I do, the template reverts to my custom index and I get no posts. When I undefine it as the posts page, it goes back to my template. What am I missing? I'm new to using this method, as it used to be done with a plugin prior to WP 2.9
So, I figured out the solution and wanted to share. Thanks for all your input, everyone.
The problem was with the name I chose for the template. I had called it "blog.php", which works fine when creating an ordinary page template. But when using a page as a posts page, Wordpress has some specific setup rules. The pertinent section of documentation, which I scoured the entire internet for using hours of my life I'll never get back, is hidden here:
Also, any Template assigned the Page will be ignored and the theme's index.php (or home.php if it exists) will control the display of the posts. (from here).
So, I named my template "home.php", since I wasn't using a home.php in this particular install, and I was off to the races. Anyway, thanks for the answers!
BTW, I think this may have been what Richard M was getting at.
Your problem might be in creating "templates" and the single post (single.php) You can create a template for any of your pages by putting this in the top of your page (after the first < ? php:
/**Template Name: ****templatenamehere**** #package WordPress * #subpackage Default_Theme */
...rest of code
This allows you to create a page called "posts" which references your new template. This way you can create a new template and then call it through a page. If this is confusing or you have tried this let me know and I will try to give you more details if you need. Thanks

How to Display Videos inside RSS Feed

I have a blog and all posts (i.e. this post) have videos in hidden div.
I want to display this videos in my [RSS feed.] But not regular blog view.4
By the way i'm using Wordpress.
How i can do it?
Thanks.
you might want to take a look at RSS enclosures. (see http://en.wikipedia.org/wiki/RSS_enclosure for more information)
here is a code example:
<enclosure url="http://example.com/file.mp3" length="123456789" type="audio/mpeg" />
since you seem to run wordpress, you might want to use specific video-blogging plugins.
you can find more information here: http://www.tubetorial.com/wordpress-videoblogging-the-easy-way/
Since you say you're using WordPress, I'd recommend setting up a specific category for these video posts (e.g. something like "RSS Only") and then edit your theme files so that category never gets displayed. See Exclude Posts From Some Category « The Loop « WordPress Codex for details on what you need to change in the theme files.

Resources