The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
3answers
55 views

obtain the author id given the post id

If $a contains the ID of a certain post, how can one obtain the corresponding author ID? I've tried with $b = get_post( $a); $c = $b->post_author; $d = $c->ID; but it does not work.
1
vote
2answers
64 views

Post-ID in url differs from $post->ID

I've got a page with a blogroll in the left column and a sidbar in the right one. When I try to retrieve the page-id inside of the sidebar like: echo $post->ID; echo get_the_ID(); The result is ...
1
vote
2answers
176 views

On Category page, How can I get the category ID?

This might be very basic question, but I can't really get the category ID on category page (actually a category page of custom type post). Filename is taxonomy-item-category.php & URL is ...
0
votes
2answers
90 views

Is there a better, more efficient way to get the post id outside the loop?

Right now I am using: $wp_query->post->ID; I want to know if there is a better way for getting the post id that consumes less resources?
0
votes
0answers
216 views

Get ID of the page where shortcode is included

I have a page with a shortcode that uses get_the_ID(). The shortcode displays custom fields from the current page. When I include that page within another page, get_the_ID() returns the ID of the ...
0
votes
2answers
3k views

How do I get the current edit page ID in the admin?

Most solutions I found are for front-end use. This is for a plugin, so the all activity is in the back-end. How do I get the page ID that's being currently use(edited) in the admin? Note I'm out of ...
3
votes
4answers
5k views

How to get page's ID if I know the title only?

Is there an exact opposite funciton to this one: get_the_title(ID) I know there's: get_the_id() But it doesn't seem to accept any arguments. So, basically, I'm looking for something like: ...
0
votes
1answer
169 views

Why is my Blog Page ID == First Post ID?

It is possible that I'm doing something wrong. Currently I'm using index.php as the main blog page. I have a page setup for the Blog and set it up in my Settings. When I try to get the Blog Page ID ...
0
votes
2answers
646 views

get the_title_attribute by id

I'm creating a list with a few permalinks which I call to with <a href="<?php echo get_permalink($id); ?>" title=".... And for the title I want to call the_title_attribute(). But it seems it ...
0
votes
1answer
437 views

Compare “Main” post ID to ID inside wp_query loop

I have a video viewing section on my site. The single post template displays a large area where the video plays and then there's a column of thumbnails representing other videos along the right side. ...
-3
votes
2answers
111 views

Query parsing only author ids

I need array only all author ids from the loop, each one only once if possible and out of all posts in the loop. Any suggestions?
0
votes
1answer
196 views

$post->ID displays wrong ID

This one is pretty weird. This code: $post->ID Displays right ID every time excepting the blog page (the page set as blog on /wp-admin/options-reading.php). On that page $post->ID returns the ...
0
votes
1answer
81 views

get id custom tables on current page

i will get id on current page. <?php $hasil = $wpdb->get_results("SELECT id,bab,tema FROM $tabel ORDER BY bab ASC"); foreach ($hasil as $bab) : ?> <tr> ...
1
vote
1answer
112 views

How to call widget by widget's id?

Is it possible to call widgets using it's id? for example I have a sidebar. In this sidebar I put meta widget and tag cloud widget. I have got their id's ($widgets_list): 'meta-2' and 'tag_cloud-2'. ...
0
votes
1answer
653 views

post_author for wp_insert_attachment

I am working on a custom theme, in which I need to programmatically inserts posts and attachments. One requirement is those posts belong to users that are not the user who is logged in and running ...
3
votes
2answers
1k views

How to obtain the user ID of the current profile being edited in WP-Admin?

Is there a way of obtaining the user ID of the profile being edited in wp-admin? I know it's in the URL if you are editing a user, EX: ./wp-admin/user-edit.php?user_id=427. Could always ...
0
votes
0answers
63 views

Using array page name together with page id to deregister script

If I use this: if (is_page(array(blabla-test-page, 20726, 20720, 38881))) {wp_deregister_script( 'gdsr_script' ); } the blabla-test-page looks like it overrides different pages, even if certain ...
0
votes
0answers
46 views

Show ID's in main section of my own page

I've included wordpress in my own website and I use the main section of the blogs aswell as the sidebar. In the sidebar there are shortcuts that lead to Id's Cat=01 p=01 etc. Everytime I click them ...
0
votes
1answer
29 views

Using class id from array for query

I'm using Event Calendar 3. Since there seems to be no easy way of querying all upcoming events as posts, I tried it this way, getting the IDs from the DB and querying the posts from that: <?php ...
0
votes
2answers
308 views

Function to grab specific image IDs from media library.

I want to grab images 161 thru 166 without having to calling my entire media library array and having to splice those up. In time, the more I have in there the more it's going to slow my site down. ...
0
votes
2answers
416 views

get USER ID in functions.php using user_register action

I am having trouble of getting the ID in user_register filter in functions.php... Here is what I got add_action( 'user_register', 'sendanotheremail' ); function sendanotheremail($user_id) { ...
-1
votes
1answer
57 views

Where to add the code for an outer container in a theme?

I have a Wordpress theme installed (SimplePress) and I would like to add an outer container to it, and I don't know exactly in which file should I add the code. This is the code I tried to use: ...
0
votes
1answer
2k views

get_posts by id not working

I have the following code: global $post; $current_post = $post->ID; $array=range(1,$current_post); $posts = get_posts('numberposts=5&post__in=' . $array . '&category='. ...
1
vote
2answers
8k views

how to get page id of a page using page slug

Im pretty new to wordpress and I was wondering if I could get a page id with it's slug. Is it possible please let me know.
0
votes
3answers
901 views

How to get post ID with hooks publish_post, new_to_publish, etc

I have two plugins, one uses the function wp_insert_post(), the other has a code like this: add_action('future_to_publish', 'myFunc', 10, 1); add_action('new_to_publish', 'myFunc', 10, 1); ...
0
votes
1answer
177 views

How To Show Get Adjacent Posts If Posts Are Sorted By Custom Field

I want to get the ID of adjacent posts. For posts sorted chronologically you can use: get_adjacent_post Are there any standard methods for finding the adjacent post if the posts are sorted by ...
0
votes
2answers
881 views

get all page IDs from wp_list_pages

I am looking for a way to output all page IDs from the following menu: <?php wp_list_pages('depth=1&exclude='3,5,11')); ?> Only top level pages needed, therefore the 'depth=1'. Any help ...
2
votes
1answer
2k views

Get page id by title?

I'm using the following code to insert the content from another wp page into my main home page. Is it possible to make it work with a page title instead of an id number? Eg. Not $page_id = 518 but ...
0
votes
2answers
275 views

Widget to show posts in the sidebar basing on its IDs

I am trying to create a widget that displays posts in the sidebar taking post IDs as input from the user. The result of my code is that the widget displays just the first entered ID and ignores the ...
0
votes
1answer
83 views

User registration add user ID?

I have created a custom user registration template for my WP website, based on this code: http://www.tutorialstag.com/create-custom-wordpress-registration-page.html. Now I was wondering if it is ...
0
votes
2answers
2k views

How to get custom image field of specific post id

I have a page where I'm pulling in content from another post, outside of the loop. I've been successfull at getting the content of the specified post, but I cannot get the image from a custom field ...
0
votes
1answer
65 views

Are Post IDs Unique Across all Post Types?

I thought Wordpress post IDs were only unique within each post type, so that the first instance of each post type would have an ID of 1 and they would count up from there. In order to get a specific ...
1
vote
1answer
56 views

Transient unique names

What would be the correct way to assign a different name to each transient for each instance of a plugin used as a widget or shortcode?
-1
votes
1answer
3k views

How to get the post's parent ID?

I have a template which outputs the blog posts (Blog Page), I open one of the posts which use single.php template, Now how can I get the ID of it's parent which is the (Blog Page)? I should say that ...
0
votes
0answers
53 views

Create hundreds of users with just ID in phpMyAdmin

I'm trying to do the same as this post. But I have a problem with the insert records into your wp_users table containing all the ID's of the members you want to import Right now, I have 3 ...
0
votes
1answer
86 views

get page id's - not get pages?

I'm trying to do something like this: Hide a page in the admin end without a plugin? However, I don't want to hardcode the page-ids. I want to get the page id's based on template-name. $pages = ...
6
votes
2answers
1k views

Get page IDs from nav items

I am trying to get all the IDs in my navigation and convert it to a string so that I can use it with wp_query to get the pages that are only listed in the nav. The code to get the IDs: $menu_name = ...
0
votes
1answer
61 views

unused post IDs

Recently I installed plugin called Delete-Revision and noticed that every post has registered few post IDs. I usually use save drafts and update post a few times when I write a post. Here's the ...
1
vote
1answer
93 views

Shortcode for a link and thumbnail

<?php // Add Shortcode function blog_shortcode( $atts ) { // Attributes extract( shortcode_atts( array( 'id' => '', ), $atts ) ); // Code if (has_post_thumbnail()) { $url ...
1
vote
1answer
376 views

Get author ID with attachment ID

I have a page, outside the loop, that display a media attachment with some basic info about it (title, uploaded date, etc). I have the attachment ID available to me via a form submitted before the ...
0
votes
1answer
75 views

Why does the page/post ID keep growing when i refresh the post-new.php file?

I created a custom post type and for debugging reasons i display the Post ID on the Add New ... page. If i refresh the page without saving or even creating a new post,(so i just press f5 on the ...
0
votes
1answer
93 views

get post by nav id

I am trying to get the post id by the navigation id to use in a loop. I made a new query to get posts. I am using multiple queries on a page because I need to. one of the queries gets page templates ...
1
vote
1answer
297 views

Style category link depending on category ID

I want to style a link depending on its ID, for instance, if the category ID is 2, then I want the link to be pink. My theme calls the category like this: <?php if (in_array('categories', ...
0
votes
1answer
411 views

Check is category parent with ids from the childs - get_term_children

I have a hierarchical category list, like: A (Parent Category) - B (Child Category) - C (Child Category) - D (Child Category) B (Parent Category) - E (Child Category) - F (Child Category) ...
0
votes
2answers
135 views

Get a post's ID

How do I get a post's ID? I know I can use the_ID(), but I have to use it in The Loop. How can I get the post's ID without the loop? Because I think using the loop just to find the post's ID will slow ...
0
votes
1answer
78 views

Making posts permalinks consistent numbers

I'm developing a new website, but I can't quite figure out a solution to my permalinks problem. My main website is http://w3spine.com, I'm sending posts to my second WP installation at ...
1
vote
1answer
112 views

How to create a dashboard widget for one user

I will start by warning you that my programming skill is limited. I need to create a dashboard widget that will display in the WP dashboard for the users with the user_id=21. So far I have tried the ...
2
votes
4answers
3k views

Custom Walker: how to get ID in function start_lvl

I am making my first custom walker to build an accordion menu. To start with I used this example: http://bitacre.com/2025/custom-nav-menu-walker-for-wordpress-themes There are two functions. First ...
0
votes
2answers
139 views

Determine if ID is page or post and query the ID

I want to look up a page id and determine if it's a page or post. Then query that id and display stuff like title, featured image, etc. This works for Pages: query_posts('page=' . ...
0
votes
2answers
271 views

get_all_category_ids for bookmark

I was wondering how to create a list of categories name and ids for Wordpress Bookmarks such as get_all_category_ids for post. I tried using the get_bookmarks, but the category does not appear in it. ...