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).

learn more… | top users | synonyms (2)

12
votes
5answers
752 views

How to mark every 3rd post

I'm working on a WordPress site for my band and I'd like to mark every 3rd post on our blog page to have a special class applied to it, anybody have any pointers on how to achieve this? Any help is ...
12
votes
2answers
3k views

Turn a URL into an Attachment / Post ID

Is there any way I can take a URL of an image and find the attachment or post id of that image in the database? Here is the situation: I'm in a loop going over all the 'img' tags that are surrounded ...
6
votes
3answers
4k views

Add extra parameters after permalink?

How can I add extra parameters after a permalink, specifically if I'm using a custom post type? For example, let's say http://mysite/album/record-name was the permalink. How can I make ...
2
votes
2answers
3k views

Next_posts_link() works only with original $wp_query

I've got custom template that I want to display paged blog posts. This is the beginning of my file: $wp_query = new WP_Query($args); if($wp_query->have_posts()){ ...
1
vote
1answer
1k views

Execute function when post is published

I try to use this function i have created when a post is published for the first time. function a_new_post($post){ $post_id = $post->ID; if ( !get_post_meta( $post_id, 'firstpublish', $single ...
11
votes
4answers
20k views

WP insert post PHP function and Custom Fields

The wordpress function is used for submitting data programatically. Standard fields to submit to incude the content, excerpt, title, date and many more. What there is no documentation for is how to ...
3
votes
2answers
5k views

Front-End Post Submission

I am trying to add a form where users can submit post from front-end. I am Following this tutorial: http:// wpshout.com/wordpress-submit-posts-from-frontend/ What I am doing is adding this code to ...
6
votes
3answers
17k views

Submit post and upload image from front-end

I am trying to do something similar to the above question. I am trying to make users post and upload images from front-end. I have already done the post form and its working. I just followed and ...
8
votes
2answers
13k views

Adding Page Attributes Metabox and Page Templates to the Posts Edit Page?

(Moderators note: Title was originally "How can I add the "Page Attributes" and/or "Page Attributes > Template" selector to POSTS editor") WP currently only allows the assignment of a "template" to ...
4
votes
1answer
2k views

Linking Two Post Types

and thanks in advance for your help. I've done some searching, and this question has been answered a couple of times with reference to the "posts 2 posts" plugin, but the documentation on that is ...
2
votes
2answers
2k views

How to limit user to publish post per day and per role?

I would like to know is there any way/Plugin to limit the user published post (in a given time span) by his role? Like this: Role A -> 1 post per day and 30 post total. Role B -> 10 post per ...
4
votes
2answers
1k views

Possible to change the URL for the regular post type without affecting the URL of other custom post types?

The Dilemma I have a few custom post types: Portfolio Items Testimonials FAQs The URL structures for these custom post types are: mysite.com/portfolio/name-of-custom-post ...
3
votes
1answer
2k views

Pretty URL with add_query_var

I'm trying to add a 'sub post' to each post on my site, eg site.com/product-one/changelog site.com/product-two/changelog site.com/product-three/changelog This is the code I'm using atm, which I ...
1
vote
2answers
453 views

Limit the post for differents custom post type in the same wp_query

I have three custom post type: books magazine videos Now i want to limit the number of post for custom post type, for example: books => 3 post magazine => 2 post videos => 1 post I used a ...
0
votes
3answers
2k views

Automatically added brs and paragraphs?

Here's my very simple shortcode: function box_shortcode( $atts, $content = null ) { extract( shortcode_atts( array( 'width' => 'auto', 'height' => 'auto', ...
2
votes
2answers
3k views

Add a checkbox to post screen that adds a class to the title

I'm needing some posts to have different title colors than others, and I figured this would be most conveniently accomplished by some sort of check box on the post creation/edit screen. How would I go ...
1
vote
2answers
906 views

How to get posts by content?

I found the following codes to get post details. However, it is not possible to get the posts by content. Does any one has any ideas? get_posts() //// get post //// $args = array( 'numberposts' ...
0
votes
2answers
304 views

Duplicate posts

I'm currently working on a Magazine style website and on the main page I have three different sections where I display the latest news. Slider, latest news and more news. The problem is I can't ...
2
votes
1answer
2k views

I am trying to create a simple frontend form for posting

i am trying to learn and create some deeper things with Wordpress. My goal is to create a code/script/plugin that will allow me to post from the frontend. I have seen many plugins, like templatic ...
3
votes
1answer
2k views

Post publish only hook?

Is there any hook which is fired only when the post is "published" for the first time. I dont want to execute my code when the post is "updated" or when its status is set to "not-published" and then ...
5
votes
2answers
518 views

Delete Associated Media Upon Page Deletion

Note Use at your own risk, it is buggy and I have run across a couple instances where it would delete ALL attachments. Unsure why. Is it possible to delete media associated with a page when that ...
4
votes
1answer
1k views

Sort posts by popularity/page views

How can I sort posts by popularity or page views in my template file? I guess I need to count page views first, is there any good plugin to integrate with to sort posts by views or what is the best ...
3
votes
4answers
1k views

Prevent Authors from viewing each others Posts

I am setting up a site where there will be multiple users as Author, the owner doesn't want the authors to be able to view each others posts, since there are some meta fields with information he'd ...
3
votes
2answers
2k views

Getting post-thumbnails from another WP site

I have two WordPress installations, one at http://inversekarma.in and the other at http://inversekarma.in/photos. The latter is a photoblog, and its theme uses the standard WP post thumbnails (EDIT: ...
5
votes
6answers
5k views

How to Create Editable Blocks of Text for the Homepage?

I'm making a site based on WordPress. It's not going to seem a blog or WP. Just a website. So WP acts like backend where the client can edit the text blocks. Question: How can I put block of text ...
4
votes
4answers
6k views

How do I add a new custom post format?

How do I add a new custom format while making a post in WordPress? The default formats are standard, aside, image, gallery... I want to add a new format of 'xyz' name. How can I do it?
3
votes
1answer
1k views

Update post counts (published, draft, unattached) in admin interface

I am working on a multi-user WordPress setup and have made it so a particular type of user can only see and interact with posts, images, pages etc that they have authored. The code to make this happen ...
1
vote
2answers
126 views

Counting words in a post

How can I count words in a post? Something like the one displayed just below the post? Can someone please show me the code for getting this. I have been searching everywhere.
0
votes
1answer
564 views

Unattaching images from a post

I currently have a custom post type in a theme I'm developing which will be used for portfolio items. So far, I have implemented functionality that allows images to be attached to a portfolio post. I ...
0
votes
2answers
1k views

how to grab first link in post… and of course call it

I have been trying to get the answer to this for ages now and wondered if anyone here could help. I would like to 'grab' the first link in a post and attach it to a button/image. I have tried the ...
-5
votes
1answer
523 views

What does this PHP function code mean? [closed]

Can someone please help me to understand each part of this code? Can you comment every line so I can understand and custom the code accordind to my purpose. Here is the link in pastebin: class ...
4
votes
1answer
620 views

Make featured image required

Is it possible to force user to set featured image on some types of posts. For example I've got custom post type mm_photo and I want to show some error message or somehow block user from publishing or ...
2
votes
2answers
401 views

Is it possible to add a first and latest posts link?

I'm using the following code to show one post in a page (Blog pages show at most is set to 1 post): <?php /** * Template Name: Front Page * @package WordPress * @subpackage Prominent * @since ...
1
vote
1answer
201 views

Publish Post After Click On A Link

I have a frontend posting form (CF7), where user inputs (among other data of course) his email. Now I set the status to pending. What I want is, that the user would get trough autoresponder a mail, ...
1
vote
2answers
2k views

How to change order of posts in admin?

How can I change the order of posts in the admin dashboard, so they display alphabetically according to title, rather than latest first?
0
votes
1answer
856 views

Getting an alphabetic post list with two letters onclick on letter

I have a website in Wordpress and a page with a list with letters like this: A B C D E F G H I ... This shows me all posts with the letter A for instance. That's nice, but I want it to make it ...
0
votes
2answers
88 views

Forcing oembeds to top of post

What's the best way to force oembed (or shortcodes too) to the top of a post? I'd like to feature youtube embeds before the actual article content, regardless of where the link was inserted. Any ...
18
votes
9answers
12k views

Stop Wordpress Wrapping Images In A “P” Tag

I have searched high and low for a simple solution to this, but to no avail. Wordpress keeps on wrapping my images in p tags and because of the eccentric nature of the layout for a site I am working ...
29
votes
2answers
86k views

Get wordpress post content by post id

How can i get wordpress posts content by post id?
10
votes
7answers
30k views

GET the excerpt by ID

Why is it that one cannot get the excerpt by ID like with the title and most other elements. eg. get_the_excerpt(ID). I know how to use it with the $post->post_excerpt function but that does not ...
4
votes
3answers
1k views

Setting a custom sub-path for blog without using pages?

Warning: fairly pedantic request ahead. I have a design that makes use of posts (I.e., the blog) and a custom post type called "howto". The site front page ("/") has a template that displays the ...
3
votes
5answers
580 views

Is it possible to direct users to a certain post based on a password entered on the home page?

I'd like to be able to have a workflow that works like so: Create a post and assign it a password Have a single-field form on the home page User enters password on home page, and is sent to the ...
7
votes
2answers
188 views

How to prevent posts from being published too close to each other?

I manage a blog which consists of about 25 writers. Sometimes a few of them are in the process of writing a new post at once, and they end up publishing them too close to each other. Is there a way ...
7
votes
3answers
175 views

Is there a way I can write a series in WordPress?

What I mean by series is like writing a book. A reader should be able to click on the book and then proceed to read the chapters. I can probably mimic it by creating a page and then linking it to a ...
1
vote
2answers
318 views

How can I allow editors to leave comments on posts that have not yet been published?

On my NFL football blog all users are allowed to make blog posts. New registrants are given contributor status. When users make a post it is reviewed by an editor, then the editor schedules the post ...
5
votes
5answers
1k views

Different post sort order within different categories

I need to give each post a unique post order for multiple Categories (per post) it is in. I can imagine a solution using custom fields whereby for each Category there is a corresponding custom field ...
5
votes
1answer
795 views

How to add a quicklink to the Posts Admin Published|Scheduled|Trash menu

Here might be an interesting idea: is it possible to add a "quicklink" to the quick links at the top of the Post Admin page (e.g. above the Bulk Actions dropdown, where it says "All | Published | ...
4
votes
2answers
2k views

How to add category to: 'wp-admin/post-new.php'?

I want to have a link to create a new post that sets the category also. I have tried wp-admin/post-new.php?post_category=12 and wp-admin/post-new.php?cat=12, but neither worked. I also tried using ...
2
votes
4answers
2k views

Change existing label in the admin bar with something else

In the admin bar an admin can create a new post by using the add new drop down. In there I want to change the label Post to something else. How can I do this? I just need the code to make the change ...
2
votes
2answers
2k views

How to add option box in “Edit Post” plugin API?

This might be kind of simple, but I couldn't find a way to do so in the WP docs. My plugin currently uses custom fields for things I could just have radio buttons/check boxes for each post. How do I ...