The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
1answer
238 views

Exclude main blog from get_blogs_of_user

I use WordPress Multisite and in the sidebar i have a box that shows a list of blogs the logged in user is a member of. I'm looking for a way to exclude the mainblog from this list. The main blog ID ...
-2
votes
1answer
388 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
3answers
797 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
316 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
736 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
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
205 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 ...
1
vote
1answer
107 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
354 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
3k 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 ...
1
vote
2answers
583 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
5k 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 ...
0
votes
2answers
519 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, ...
0
votes
4answers
933 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 ...
5
votes
1answer
915 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
104 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
229 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
127 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
82 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 ...
0
votes
1answer
201 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 ...
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
2k 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
617 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 ...
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: ...