Show my custom post id if a country or ip

I believe you can do something like this (not tested): if($_SERVER[‘REMOTE_ADDR’]==”89.0.0.0″ && $post->ID==15){ $post5 = get_post(‘5′); echo $post5->post_title; //Call custom meta using $post5->ID; } Update: If you’d like to replace the original object you can do the following: if($_SERVER[‘REMOTE_ADDR’]==”89.0.0.0″ && $post->ID==15){ global $post; $post = get_post(‘5’); setup_postdata($post); //Here you can call for the_content() or the_title … Read more

excerpt in template for specific page

The following code will query the “blog” category for the latest three published posts and loop through these results to display the excerpt from each. $args = array( ‘category_name’ => ‘blog’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => 3, ); $blog_posts = new WP_Query( $args ); if ( $blog_posts->have_posts() ): while ( $blog_posts->have_posts() ): $blog_posts->the_post(); // Do … Read more

Custom Post Type Trouble

you likely need to do a flush re-write. go to settings/permalinks in the dashboard and click save. You’ll be good to go. In the future you can add this directly to your CPT plugin. I would suggest getting a bit more creative with your naming though so you don’t have conflicts later.

Output fields manually in Woocommerce email templates

Probably the easiest way is to manually construct a new Billing address format by creating a copy of the WooCommerce email address template in /your-theme-driectory/woocommerce/emails/email-addresses.php by replacing the original echo $order->get_formatted_billing_address(); with for example: $output=”<strong>Customer Name: </strong>”.get_post_meta($order->id, ‘_billing_first_name’, true).'<br>’; $output .= ‘<strong>Customer Last Name: </strong>’.get_post_meta($order->id, ‘_billing_last_name’, true).'<br>’; $output .= ‘<strong>Company Name: </strong>’.get_post_meta($order->id, ‘_billing_company’, true).'<br>’; $output … Read more

Implement HEAD and TITLE tags with DB DATA

What data are you looking to put in the tags? I’m just trying to understand if it’s data that WordPress may already make available. This seems to be the right way to get to data in the WordPress database: https://codex.wordpress.org/Class_Reference/wpdb Once you have the data, you can use wp_head to get the values in the … Read more

How to create a template for categories

So for this you’d want to use Category Templates in your theme file, which you can read about in the codex here: https://codex.wordpress.org/Category_Templates Basically, let’s say you have the category “Trending Articles”, with the category slug being trending. You would want to copy the category template from your current theme (category.php, or if that doesn’t … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)