The tag has no usage guidance.

learn more… | top users | synonyms

4
votes
2answers
131 views

What is an alternative to get_page_by_title()?

I'm coding a theme where I want to display information in the footer that's only available on a template page. I have been using get_page_by_title() which works well if you know what the page will be ...
0
votes
1answer
25 views

Custom Fields with get_post()

I am using get_post() to call a single Wordpress post using it's post ID. I have successfully managed to pull the content / title of the post but would like to also pull custom fields also. The code ...
0
votes
1answer
51 views

Which method is faster to get a single post?

If I want to get only a single post with the featured thumbnail. Which of the function is better to use (for the performance) get_post or WP_Query?
5
votes
1answer
156 views

How to get the image EXIF date/time and use it for the WP post date/time

I currently have the following working function. add_action('add_attachment', 'create_post_from_image'); function create_post_from_image($id) { if (wp_attachment_is_image($id)) { $image = ...
0
votes
1answer
44 views

Loading post template that contains a nested loop with ajax

I'm currently working on a project where I'm loading a post with ajax. I'm using get_post() to get the post, setup_postdata() to setup the post data, and get_template_part() to load the template ...
-1
votes
2answers
41 views

make get_post work in the loop

I'm getting a post by id with get_post(); $post = get_post(17); $page = get_post_meta(17); setup_postdata( $post ); include($page['_wp_page_template'][0]); After getting the post I include a ...
0
votes
0answers
21 views

Filter to set a variable once a post is populated?

I'm working on a playlists plugin. The playlists are just custom post types; and they have extra properties I need to populate once a 'playlist' post is loaded. So the idea would be to have a ...
0
votes
1answer
173 views

Best way to check if a post with specific meta exists

I am building a function in wordpress that reads an XML file and imports 100-500 events as a post type to wordpress. The events have a lot of meta data that is saved as post meta. One of the meta data ...
0
votes
1answer
41 views

Function to get the name in database table from the comma separated string

I already created admin column in WP using this code: add_filter('manage_pages_columns', 'page_custom_cols', 10); function page_custom_cols($pages_columns, $post_type) { $pages_columns['user_group'] ...
0
votes
1answer
66 views

Modifying Wordpress XML-RPC Built-Ins

In short, I want to be able to modify the wp.getPost response to also return additional data, like the permalink. I thought it would be as easy as just calling the same function the xml-rpc code ...
1
vote
1answer
39 views

Obtain page data and use regular loop

Is there a way to obtain the data from a certain page outside the regular flow, more efficiently than via get_post($id)? I know that I can get for example the title with $post = get_post($id); $title ...
1
vote
0answers
60 views

Formatting get_post content doesn't allow JS content to function properly

I am currently pulling in the latest post on a category page based on which category you click on. When you click on the category "Code Examples" you see this: I am using the Crayon syntax ...
0
votes
0answers
49 views

getpost content with all formatting for admin pages

All My post usually uses various plugin based data manipulations (Like visual layout, grouping, plugin css, etc) And now I want to render a post content in my admin page. On using following code: ...
0
votes
2answers
2k views

Get the excerpt by page ID from another blog in a wordpress multisite?

I am trying to get the first paragraph on a page where page ID=2 and blog ID=1. I want to display this paragraph on a page in blog id=2. I have added the following code to the template page. //gets ...
0
votes
2answers
1k views

Get current post data into array?

I'm trying to achieve a similar effect to get_page($id), but with the current post acting as the argument for get_post(). Something like this pseudocode: get_post($this=>ID); . Seems simple, but I ...
0
votes
1answer
59 views

Get post by Category in custom template

I want get all categor and after that i want get 5 post per category. but my code not work! http://pastebin.com/vxDSGGZk <?php $categories=get_categories(''); foreach($categories as ...
0
votes
1answer
853 views

Retrieving custom field value with get_post?

There's no mention of custom fields values in Get_post's codex page. Is it impossible to use get_post to get a custom field value of some post, and if so, is it necessary to perform a whole loop just ...
0
votes
1answer
296 views

How to get post meta in functions?

I set an email button in functions php. The email is sent when clicking on a front-end update post button. The problem is: the email is sent but I can't get the post title to appear in the post. I ...
0
votes
4answers
1k views

How to limit the characters shown on the page - get_content

I've the below php to display the content of the post id#9 on my 'home page' of my site, so that whenever the client updates the page, it's reflected on the homepage as well - rather than having to ...
0
votes
2answers
577 views

Get post content intro text on category.php?

For some categories on my site there's introduction text that needs formatting (so using the category description isn't an option) and placing at the top of categories.php. I've added a post ID to ...
0
votes
1answer
265 views

using query_posts to pull posts out of a category in a while loop. Getting odd echo

I have a custom template file I've been workin on. I have this code performing a loop after it queries posts from a certain category. This works and I have each post configured with styled divs, but ...
1
vote
2answers
2k views

Elegant way to include only published posts with get_objects_in_term()?

The obvious way is to iterate through the resulting array of IDs, get_post for each and test against post_status == 'publish'. But I wonder whether this could cause memory issues since get_post will ...