Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 6035

Posts are the core of WordPress. They store content, are categorized, and are expansible with meta. Posts are grouped by post type, and within their post type by taxonomy (though a taxonomy can span more than one post type).

2 votes

Post visibility on the basis of roles

Give your custom roles the capability to "read_member_posts" or whatever. Then you could apply a filter to the_content() add_filter( 'the_content', 'my_wpse20347_filter' ); function my_wpse20347_fi …
chrisguitarguy's user avatar
0 votes
Accepted

Replace the attribute_escape to esc_attr()

Deprecation is... status applied to features, characteristics, or practices to indicate that they should be avoided, typically because they have been superseded. In other words, attribute_escape …
chrisguitarguy's user avatar
1 vote
Accepted

How to display Changing post link for 24 hours in x category

add_action( 'wpse24234_daily', 'wpse24234_daily_cb' ); function wpse24234_daily_cb() { $posts = get_posts( array( 'cat' => YOUR_CATEGORY_ID_HERE, 'numberposts' => 1, 'orderby' => 'rand' ) ); if … empty( $posts ) ) set_transient( 'cat_1_post', $posts[0]->ID, 60 * 60 * 12 ); } Then on the front end, you can get the post ID with get transient, and use the ID to pull in whatever other stuff …
chrisguitarguy's user avatar
3 votes

WordPress post tag & custom field

To convert the old custom fields, you can write a plugin that, on activation, fetches all the posts with your custom field name and converts them to tags with the handy wp_set_post_terms. … php register_activation_hook( __FILE__, 'wpse29498_field_to_tag' ); function wpse29498_field_to_tag() { $posts = get_posts( array( 'post_type' => WPSE29498_TYPE, …
chrisguitarguy's user avatar
1 vote
Accepted

Style Differently Edited Posts

This is very similar to @mrwweb's answer, but a little bit more fleshed out. We're also not going to overload taxonomies in order to get our post class, but do what you wanted initially: use a custom …
chrisguitarguy's user avatar
0 votes
Accepted

Get most recent posts by category that aren't first overall

all_posts = array(); while(have_posts()): the_post(); $all_posts[] = $post->ID; // do stuff with the main loop here endwhile; On each subsequent loop, use the $all_posts variable to exclude posts … the_post(); $all_posts[] = $post->ID; // display stuff here } } } Just keep appending post IDs to the $all_posts variable to make sure subsequent queries don't include posts
chrisguitarguy's user avatar
0 votes

'posts_per_page' in costum page type

If you want all the posts use nopaging or posts_per_page => -1. … ([ 'post_type' => 'producenter', 'nopaging' => true, 'orderby' => 'rand', 'post__not_in' => [$post->ID], ]); As far as why it's only showing 1 post, is that what you have set in the default posts
chrisguitarguy's user avatar
2 votes
Accepted

Get a post's ID

It probably won't slow down your script: WordPress fetchs all the queried posts at once, so the database hit has already happened. …
chrisguitarguy's user avatar
1 vote

get last post's link with SQL query

Assuming each site is WP, they'll both have RSS feeds. You're better off just to fetch the RSS feed and get the latest post link from that. WP even has some built in support RSS parsing! <?php /** …
chrisguitarguy's user avatar
1 vote

Wordpress Architecture as a CMS - Posts & Pages

Here's an example to do what you need with Posts 2 Posts <? … I can provide you some example code for the above two options, but I'd strongly suggest you check out Posts 2 Posts. …
chrisguitarguy's user avatar
3 votes
Accepted

Different permalink for posts and authors

I would just change the author_base on the global $wp_rewrite object. Also add a field to the Permalink options page, so you can change it at will. To start: a class to wrap everything up. <?php cla …
chrisguitarguy's user avatar
1 vote
Accepted

Hide content from Post Preview

There is the handy is_preview function. So somewhere in your single.php. <?php if (!is_preview()) { // Show stuff that doesn't belong on a preview. }
chrisguitarguy's user avatar
4 votes
Accepted

How to order posts in an arbitrary order?

First off, query_posts is terrible doesn't use it. It does all kinds of fun things like mess up the very useful conditional tags like is_singular and the like as well as mess up pagination. Short of …
chrisguitarguy's user avatar
16 votes
Accepted

get all posts ID from a category

php /** * Retrieve list of latest posts or posts matching criteria. * * The defaults are as follows: * 'numberposts' - Default is 5. Total number of posts to retrieve. … * 'category' - What category to pull the posts from. * 'orderby' - Default is 'post_date'. How to order the posts. * 'order' - Default is 'DESC'. The order to retrieve the posts. …
chrisguitarguy's user avatar
2 votes
Accepted

How can I add a box to edit Order on a regular post?

<?php add_action( 'init', 'wpse31629_init' ); function wpse31629_init() { add_post_type_support( 'post', 'page-attributes' ); } Add that to your functions.php or in a plugin file and you'll get …
chrisguitarguy's user avatar

15 30 50 per page