Tagged Questions

The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
1answer
16 views

Issue with WP_Query (need a array of selected ID's)

Today I have <?php $loop = new WP_Query( array( 'post_type' => 'inspirations', 'posts_per_page' => 50 ) ); ?> <?php while ( $loop->have_posts() ) : $loop->the_post(); ?> ...
0
votes
1answer
17 views

Accessing Post ID Within Loop

I have a page called Products with an ID of '8' Within that, I have the following template part <?php get_template_part('loop', 'feed-products' ); ?> Then within that file, I have this ...
0
votes
1answer
46 views

How to get selected taxonomy or category ID if using custom walker?

I'm building a taxonomy->child taxonomy dropdowns where the child will only be active if the parent is selected. Everything works great, except that I'm using wp_dropdown_categories for the parent ...
5
votes
4answers
331 views

Are post ID's reliable?

I understand that post ID's are unique, but are they reliable as persistent data ID's? More specifically, is there a guarantee that, through a migration or another data exchange, post ID's will not ...
0
votes
1answer
46 views

how to get the post id in plugin

I have a plugin that I'm working on and I'm having trouble getting the post id so jquery can use it. I'm able to get it using the admin_head hook but I'm not sure how I can return it to jquery. I'm ...
1
vote
1answer
39 views

Make slug as ID Number for custom post types

I want to make the slug for each of my custom post types to be the post ID number. How do I do this? None of my posts accept post title, content, or anything else - they require different data which ...
0
votes
1answer
34 views

How do post IDs work in WordPress?

So I have 2 blog posts so far and the first one has ID 8 and second one has ID 12. How exactly does WordPress count those IDs? What if I want to change ID 8 and ID 12 to ID 1 and ID 2? I have some ...
0
votes
0answers
15 views

Pulling Total Count or all post ID's

The following code displays the amount of supporters each of my authors has with my wordpress site. I am trying to display the total supporters on the home page for the whole entire website. I ...
1
vote
1answer
33 views

Display site administrator's id by current blog id inside link

I need to add current subsite admin id on the end of the ref link. For example 1.example.com site admin id is 4 - the link displayed on 1.example.com should look like http://example.com/?ref=4 The ...
0
votes
1answer
37 views

Importing posts from old website to new conflicting post ID's?

I am wondering when I am importing posts from my old site into my new website, which has already some posts in it. Do the imported posts get a new ID or do they overrule the existing posts ID's?
0
votes
1answer
37 views

Are post, page and category IDs unique to each other?

I was looking for a function to get all ancestors of a post or category and found get_ancestors( $object_id, $object_type ). To my surprise, the Codex shows that the second parameter is required: ...
0
votes
1answer
79 views

get_post_meta fields don't show up on posts page

I'm new here, and to coding! I've been working hard (so, so hard...so hard) to create my website and with occasional help I've created a look and feel I like using some custom get_post_meta fields for ...
0
votes
1answer
98 views

At my posts archive page, outside the loop, get_the_id() returns the top most post's ID

I'm trying to get the ID of my posts archive page. It's set via the admin as the posts page so it already has the default Query. The template I'm using is index.php, Tried using page-blog.php but ...
0
votes
0answers
49 views

Member's area with private content?

To begin with, sorry for my english.. and thank you Goggle translate! :) I come to speak here because nobody knows answer me in my country. here is my problem: I created a website (in local for the ...
0
votes
3answers
28 views

ID of Front-Page

I like to get the ID of the selected front page. My page uses an Template for that page. I've read about get_option('page_on_front'), but this didn't work for me. Is there any function to get this ...
1
vote
1answer
222 views

How can I get an array of all IDs from the current queried object?

I am trying to join an array of post IDs together. Right now, it seems my code is creating a separate array for each ID, instead of one array with each ID. This is the code that I have come up with. ...
0
votes
3answers
326 views

get post id in while loops outputting page id

it's been a while since I used wordpress and I am trying to us e advanced custom fields, I am trying to output the post ID inside a loop on a page, so i can use get_field to output the post contents. ...
0
votes
0answers
77 views

Change id=“respond” to the comments container

On the same page, I have 3 comment threads. Each comment has a meta that tells in which tread they have to be displayed in. At the end of each thread, I have a form to post a comment in this specific ...
0
votes
2answers
38 views

How to get any tag ID

I want to exclude a certain tag from my home page not a category only post that hold the tag for example "olive"; I found a function for that which is like this function exclude_tag($query) { ...
0
votes
1answer
33 views

GET Taxonomy ID

I have this line where "5" is the taxonomy ID. <?php echo function xyz (5,'product_cat'); ?> How can I change this to make it auto recognize always the taxonomy ID of the current page? Tried ...
1
vote
2answers
170 views

Does an article (post) id ever change?

So I'm working on a plugin for wordpress, and a novice at it as well. I need to use the ID of a wordpress post, or blog article rather, as a unique reference id, or lets say in database terms, a ...
1
vote
1answer
2k views

Get current post id in functions.php

I have a wp_localize_script() function in my functions.php where I need to push the current post ID of the current post to a jQuery file. So I was wondering how you can get the current post ID of a ...
0
votes
1answer
75 views

Save attachment ID instead of URL in custom field

I am testing several frameworks (currently Vafpress) to help me creating custom meta boxes. I need to save a lot of attachments with my posts but noticed that the attachment is saved with its full ...
0
votes
0answers
100 views

How to assign custom field an unique number?

I have created a CPT for a client who will use this to manage payments. Their database currently has assigned ID for each of their clients. I have imported the data in a custom field for them. The ...
1
vote
1answer
700 views

getting parent page id when using custom menu.

Im using custom menus to display a menu using wp_nav_menu(). I want to get the_content() of the parent in the menu, without setting it as a parent page in pages. Is there a way to get the parent id ...
0
votes
1answer
123 views

Give a unique ID while saving

I have in my theme custom post types (products) with some meta-boxes. My client asked me, to automaticly give a unique SKU (meta-box) while saving that product. My thought: Give a random ID => ...
0
votes
1answer
81 views

The loop starting at a certain ID

Is it possible to start the loop from a certain post ID? I would like to get all the post starting at a certain ID, decendingly. To explain, I have to make sum assumptions first. Assume that my ...
0
votes
1answer
30 views

Changing starting number of User ID

I've got a client who would like their online user registration to match their current database. Thus they'd like their wordpress sign ups to start with 00100, I can't seem to find a plugin that ...
2
votes
1answer
2k views

Creating a WordPress admin page without a menu for a plugin

I am writing a plugin, that will list a number of entries from a custom set of tables. I added the main page for the plugin using the following WordPress functions: // Add menu and pages to ...
0
votes
1answer
126 views

Help getting previously visited pages ID

I'm using ACF plugin and I want to pull a custom field from the previous page. I have a WP site that has a homepage and then 20 sub pages. Each sub page is for a specific city and each city has its ...
2
votes
1answer
118 views

How can I display a specific user's first published post?

I'm looking for a way to display a user's first published post using their unique ID. I have a function that calls a list of specific users using their IDs, and would like to display the date the ...
0
votes
1answer
82 views

linking to post outside the loop

Is there an easy way to link to a specific page/post outside the loop? I used the get_permalink() code as follows. <a href="<?php echo get_permalink( 164 ); ?>/post-slug/"> </a> ...
0
votes
0answers
104 views

Using Post ID and Page ID in same function

I've written a function to display a custom sidebar, which is outputted as a sidebar. On some pages, I have a Custom Field called 'show_sidebar', which I can assign as 'false' on pages which I do not ...
0
votes
1answer
120 views

Get posts by list of post IDs ordered by those IDs?

I am going to make a "favourite" posts box, but the article id's are stored in another DB so I only get an array of IDs (which are relevant to the WP DB). I think it could be done with get_posts() or ...
0
votes
1answer
35 views

Syling Custom Fields echo's from from functions.php

With the help of User Borek I've managed to get Custom Fields displaying on my siteby putting the below in the functions.php: function custom_field_before_content() { if(is_page() || is_single() || ...
0
votes
1answer
48 views

Are all ID's used unique?

I'm using JSON api plugin to pull data from wordpress into an app I am making. I need a unique identifier to make sure I don't have any duplicates WHILE also using the identifier as a way to sort from ...
1
vote
2answers
262 views

Get comment content by comment ID

So I've been trying for a hour or so now to list comment by it's ID. I've tried the get_comment($id, $output) function but it didn't work well, so I went back to whatever is shown below, but it just ...
0
votes
0answers
180 views

Infinite scroll jPlayer callback with PHP and post id?

How can I call the correct callback function for infinite scroll plugin on WordPress with variable <?php the_ID() ?> ? I'm trying to connect jPlayer like this: Code in php: <script ...
-2
votes
1answer
86 views

How to get page title with the page ID?

My page ID is: 30601 How can get the title of this ID? I want get page's title with ID.
0
votes
3answers
54 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
4k views

get post author id outside loop

I need to place in post edit dashboard metabox with post author e-mail (or other user meta fields). So it can be edited when admin reviews this post. $meta_id = get_the_author_meta( 'user_email', ...
1
vote
2answers
63 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 ...
0
votes
1answer
1k views

How do I display Youtube/Vimeo video ID on custom post type when user enters it in custom meta box?

I have created a 2x shortcodes that displays a youtube video and vimeo video when the user enters the videos id in it, for example: [youtube id=""] [vimeo id=""]. Instead of entering this in my post ...
0
votes
0answers
208 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
88 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
2answers
2k 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 ...
0
votes
1answer
165 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
607 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
414 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. ...
1
vote
1answer
1k views

Add id to menu items in wp_nav_menu

I'm using wp_nav_menu in Wordpress to create my navigation The output is similar to this(I have removed href links) <nav id="pageNav"> <ul id="menu-headernav" class="menu"> ...