The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
2answers
190 views

Get custom field from page, in a post?

I'm not quite sure how it works, if you're on a post (single.php), does it count page.php as the page it's on? What i need to do, is get a custom field assigned to a page, from a blog post. I need it ...
1
vote
2answers
249 views

Getting the ID of any image for use in functions.php

I've added two custom fields to attachments on my site, so the user can add a special image credit. I'm trying to write a function that looks to see if either of the custom fields are populated, and ...
0
votes
1answer
3k views

Display posts from an array of ID's

The result of the query so far is the print of the array, Array ( [0] => 309 [1] => 10 ), 309 & 10 are the correct id's of the posts I want to display, and "No posts were found" the result of ...
0
votes
1answer
49 views

How do I get a array, with the right order of the nested comments?

array (size=10) 'comment 0' => array (size=2) 'comment_id' => string '22' (length=2) 'parent_of' => string '0' (length=1) 'comment 1' => array (size=2) 'comment_id' => ...
0
votes
4answers
999 views

How can I receive the image id using the media box?

The code below allows me to retrieve the image string, when Insert to Post has been pressed, but what would be the correct way to retrieve the ID of the image? So I can retrieve all information ...
1
vote
1answer
80 views

Can I get the ID of an inserted / linked image?

I am using this code to get the url of first inserted image in a post. Is there any way I can get the ID of that image. global $post, $posts; $first_img = ''; ob_start(); ...
1
vote
0answers
161 views

Passing the page ID to a login php script

I'm trying to create a simple registration process which goes like this, A visitor clicks on a link (which is viewable only after entering some information such as name, email, phone etc.) This ...
0
votes
1answer
103 views

retrieve the oldest post id

I'm trying to get the ID of the oldest post with the post_type = job_listing and post_status = publish. I'm using the code below but it does not work. Could anyone please help me $oldestID = ...
0
votes
1answer
143 views

Is there a way to show attachment IDs on the attachment info screen?

I want to use attachment IDs for shortcodes, but if the image is published with a permalink, it's harder to find the ID. I've found some functions online that can turn the attachment url into its ID, ...
2
votes
2answers
2k views

Post ID At The End Of Permalink URL Effects Performance (Positively)?

HARD NOTE: This question is solely about performance, and NOT search engine optimization. So, please make sure your answers are as such. W.r.t permalinks, "year" is the most obvious numeric of ...
0
votes
1answer
601 views

orderby not working for query_posts using array of IDs

I have an array of IDs that i send to query_posts to get the posts (which works fine) but it seems to always put the attachment(562) last even though it is the newest. Also tried title and ASC vs DESC ...
-2
votes
1answer
418 views

How to define category ID in an array?

I have the following: <?php if ( array( 'is_category', 'is_tag' ) ) { ?> What I want to do is (that doesn't quite work): <?php if ( array( 'is_category('13')', 'is_tag' ) ) { ?> So ...
0
votes
2answers
1k views

How to get ID of the page included with get_page()?

I'm rewriting the question, including exemplary code, I hope it will be easier to understand now. 1. My shortcode: function testid_shortcode( ) { global $post; return ...
0
votes
1answer
355 views

Query specific posts from parent by slug rather ID

I'm developing a theme in a local machine and migrating it to a production server. To keep things in sync, i'm trying to avoid any queries of specific ID's On the homepage, i'm trying to query the ...
1
vote
1answer
813 views

Get the post_id of a new post

There are several ways to get the id of a post after it has been saved (auto, etc.), but is there a way to get the post id immediately after you create a new post? I am trying to create a directory ...
0
votes
1answer
54 views

How can I query the db to access current post information?

Alright y'all. I want to dynamically display the information of the 2 most current posts to the screen. So far I have only been able to get results by hard coding the ID into the query. Is there a way ...
0
votes
1answer
235 views

Can a page_id and a post_id be same?

Wordpress generates ID's for each page/post. Do pages in wordpress share the same ID column in the database as the posts? I mean, if a site has both posts and pages, can one or more page_ID's be same ...
0
votes
1answer
410 views

How to get post id of last approved comment?

Can you help me with something simple? How can I get the post id of the last approved comment? I want to assign it to a variable. Thanks so much in advance!
3
votes
2answers
4k views

ID for posts/blogs page

I have a website which has a static front page and a blog page where all the blogs are displayed. I am using my own theme and have created some custom meta boxes that display content in a sidebar ...
0
votes
2answers
531 views

Wordpress loop: Display <div> if posts exist

In a single post template I am trying to output some header text in a <div> and display links to related posts in a <ul> if related posts exist (based on tags). If there are no posts, ...
2
votes
2answers
654 views

Get ID of “root-page”

I have an url that looks like this http://apploadny.appload.nu/tjanster/webbutveckling/ I want to get the ID of the page "tjanster", how can i do that?
4
votes
2answers
6k views

How to get permalink and title from post ID?

I have stored an array of post IDs and I would like to list the posts as links, meaning I need to get the title and permalink for the post ID - $id. The list should be echoed out by the following if ...
5
votes
1answer
1k views

Settings API - creating reusable form elements?

I have a set of settings fields: (...) add_settings_field( 'Option1', 'Option 1', 'textarea', 'page1', 'plugin_options'); add_settings_field( 'Option2', 'Option 2', 'textarea', 'page1', ...
0
votes
1answer
105 views

Why would get_posts be ignoring posts with 2-digit ids?

I'm using this code to list child pages of the current page and similar code to get child pages of all ancestors to use in a sidebar contextual hierarchical nav menu: $pageset = ...
1
vote
2answers
234 views

custom admin thumbnail for videos, not getting post's id?

In the attachments edit page i'm trying to use the selected thumbnail instead of the default icon. 99% of the way there but i can't get the attachment's id into the function. Am i missing something ...
3
votes
2answers
4k views

Get user id from email?

I'm working on an email system, and I'm onto the unsubscribing stage. Since most of my users would not know their user ID, I'm asking them to put their email into a text box (definitely preferred, ...
0
votes
1answer
133 views

Print_r displaying two different post->ID if placed in sidebar or single.php

My website is displaying, if print_r, two different ID for the same post. If i ask: <?php echo $post->ID;?> in the single.php it gives me a number. If i do the same thing in the sidebar it ...
0
votes
1answer
206 views

Setting post_id for single.php based on URL without a redirect

I'm migrating a Joomla! database to Wordpress and the website has to remain exact regarding URLs. The Joomla site has its posts with .html extensions, and the importer I created maps the Joomla file ...
0
votes
1answer
85 views

Use Author Ids or Names to echo different output inside loop

Is there a way to use the author ids (or names) to echo different output for different authors (in this case author id 7 and author admin? I tried the following but it didn't work. ?php if ...
1
vote
1answer
3k views

Get previously visited page ID

I would like to get the ID (or permalink) of the page the visitor visited just before visiting the current page - in other words the ID of the last page in the browser history. Can this be done? Any ...
3
votes
1answer
3k views

Echo author ID in author.php

This is probably a super simple question. But how do I echo the ID of a user on author.php? I've tried the_author_meta('ID') But it didn't seem to want to work. I want to echo it at the end of a ...
4
votes
1answer
3k views

Get page ID of page that is set as the posts page

In WordPress settings you can set a page as the Posts Page. This can be found: WP-Admin->Settings->Reading Settings->Front page displays How do I retrieve the page ID that is set in this ...
1
vote
1answer
639 views

current post with current author

how can i check if the current post belongs to the current author? this is my basic code; ` if($curpost) { wpuf_edit_show_form($curpost); } else { $error = ...
0
votes
1answer
2k views

How to get the post id (of the parent custom custom type) in a loop inside a widget?

Below there is a widget with a Wordpress loop inside. It works as expected. The only problem is this part: 'post_parent' => $post->ID, The widget is not getting the post->ID of the parent ...
0
votes
1answer
2k views

Add category to custom post type automatically, using category slug

I'm using this excellent function to automatically add a category to my custom post type "Videos" on publish, if there's no category already chosen. This works great: function ...
0
votes
1answer
2k views

Getting post id from wp_insert_post_data function?

I'm trying to use the function get_the_tags() from outside the 'loop'. I understand this can be achieved by using the post ID like get_the_tags($postID). Does anyone know how I can get the post ID ...