Articles of get the id

Conditional using get_the_ID() not working

I’m using this script to not show title on a specific page <?php if (get_the_ID() != 50){ ?> Now I need to add another page: <?php if ((get_the_ID() != 50) || (get_the_ID() != 317)){ ?> But it’s not working.

Call post-id from URL hash not working?

I’m trying to have a modal box open by default when calling it by its id. For example, if i enter the url (#post28 being the ID of the post) I will land with the moadal box and the content of the post-28. For this I have been using the following jquery ( iattach […]

wp_get_current_user always returns 0 continued

I have been busting my head trying to get the user ID with every piece of code possible but it always comes back “0”. Not sure what I’m doing wrong. I started out using this: <?php $user_info = get_userdata(1); echo ‘Username: ‘ . $user_info->user_login . “\n”; echo ‘User level: ‘ . $user_info->user_level . “\n”; echo […]

Extracting the post_id via the wp_insert_post action (external db query)

i’m writing a little action plugin. everytime a new post is created, a new table should be created in an external db. The name of the table sholud reflect the post_id of the newly created post, but i can0t figure how to pass it. Here’s my code so far (for php purists, forgive me for […]

How to Use PHP Code In-Page?

I am looking to create a dynamic Add-to-Cart button. The problem is that I need my server to dynamically create the “add-to-cart” URL. Currently, I have a static example built here at this link. You’ll notice at the bottom of the page is a pay-per-post function, and an “Unlock Full Article” button. I would like […]

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: $title = ‘Something’; get_the_id($title); I already know this solution: global $wpdb; $post_name = get_query_var(‘name’); $post_id = $wpdb->get_var(“SELECT ID FROM $wpdb->posts WHERE post_name = $post_name”); But maybe […]

get_the_ID() is working on my local development but not on staging server

Great to see a StackExchange for WP! Ok so I’m working on pulling images and dates from piklist custom post types and I got this working on my local, BUT when I move it to WPEngine I get a white page until I take the code out. The date code doesn’t throw a blank page […]