The id tag has no wiki summary.
4
votes
1answer
454 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', ...
4
votes
2answers
76 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 = ...
3
votes
2answers
2k 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, ...
3
votes
3answers
3k 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:
...
2
votes
2answers
962 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 ...
2
votes
2answers
716 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 ...
2
votes
2answers
980 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 ...
2
votes
2answers
244 views
Creating a Front-end based User Search
I am working on a membership site which requires a front-end user search. I have been searching for an answer like a mad man, and I could really use some help! While there are several plugins that ...
2
votes
2answers
102 views
How to add the category ID to admin page
I want to add the categories ID to admin page.
I call it for my functions.php: require_once('includes/categories_custom_id.php');
The part of code:
function categoriesColumnsHeader($columns) {
...
1
vote
1answer
362 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 ...
1
vote
4answers
613 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 ...
1
vote
1answer
361 views
Why id in urls doesn't work and slug yes?
I'm lost, I don't understand why this works
http://website.com/?tag=my-cat-slug
and not this
http://website.com/?tag=15
It's really annoying because wp_dropdown_categories() only provides ids as ...
1
vote
2answers
188 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?
1
vote
1answer
26 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
999 views
get all posts ID from a category
Problem: I need to get an array of ID's of posts from a given category If the category have any posts. This is to be used on a plugin options page.
So far I have:
$posts = ...
1
vote
2answers
184 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 ...
1
vote
1answer
18 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
vote
1answer
32 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 ...
1
vote
2answers
108 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 ...
1
vote
1answer
933 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 ...
1
vote
1answer
145 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
429 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 = ...
1
vote
1answer
78 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 ...
1
vote
1answer
122 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', ...
1
vote
1answer
55 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
117 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 ...
1
vote
0answers
81 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
2answers
533 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
4answers
537 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 ...
0
votes
1answer
1k 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 ...
0
votes
1answer
19 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 ...
0
votes
1answer
35 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
237 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
1answer
52 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
91 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 = ...
0
votes
1answer
1k 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
24 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 ...
0
votes
2answers
53 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
143 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
1answer
48 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 ...
0
votes
2answers
69 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
1answer
32 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
1answer
94 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, ...
0
votes
1answer
134 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 ...
0
votes
1answer
48 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
981 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
82 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
122 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!
0
votes
1answer
88 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
67 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 ...
