show recent posts php code error?

Looks like you have the Posts for Page plugin installed. I don’t know where you have put that code you mention, but the page is generated by the shortcode, which says that output should be limited to the beauty category. You probably don’t need to write code yourself. Read the manual of the plugin and … Read more

add button to specific post

Assuming that the hook you have used is correct; below is the updated code which you can use: function custom_listify_single_job_listing_actions_after() { global $post; if( $post->ID == 1464 ) { $url = get_post_meta( $post->ID, ‘your_custom_meta_key’, true ); echo ‘<a href=”‘ . esc_url( $url ) . ‘” class=”button”>My Button</a>’; } } add_filter( ‘listify_single_job_listing_actions_after’, ‘custom_listify_single_job_listing_actions_after’ ); Let me … Read more

How to replace the default domain on wp get shortlink

You can filter the link returned by wp_get_shortlink() using get_shortlink filter. add_filter( ‘get_shortlink’, ‘cyb_replace_domain_shortlink’ ); function cyb_replace_domain_shortlink( $shortlink ) { return str_replace( ‘mydomain.com’, ‘myalternatedomain.com’, $shortlink ); }

Calling PHP Titles inside Javascript Markup

First, don’t echo your php, but assemble everything in a string, let’s say $titlestring. Next, make this string available for access by the javascript (the slug is the one you used to register the script): $params = array ( ‘titlestring’ => $titlestring, ); wp_localize_script (‘your-script-slug’, ‘IframeTitle’, $params); Finally, access the variable in the script: ‘<div … Read more

Get wp_current_user_id using PHP and MySQL

Thanks to @Samuel Elh I manage to get this done. I added this to my order-confirmation.php after I included config.php require (‘../wp-blog-header.php’); global $wpdb; global $current_user; get_currentuserinfo(); $skrivID = $current_user->ID; Then the insert query, I added the table I wanted the user ID stored in and used the variable $skrivID as value. $sql = mysqli_query($db_conn, … Read more