Tag page that displays specific posts

Create tag.php & save it in your theme directory. This is a default behavior of wordpress. So you don’t have to struggle with it. <?php if ( have_posts() ) : // Start the Loop. while ( have_posts() ) : the_post(); // Do your stuff here such as below the_title(); the_content(); endwhile; else: echo ‘No Post … Read more

How to create custom page templates with default page layout framework?

I think you are doing this right… but in the wrong direction. What if you separate your default structure like: content-header.php <?php get_header(); get_sidebar(); ?> <div id=”content”> content-footer.php </div> <?php get_footer(); ?> And then you can use get_template_part to put all together: index.php <?php get_template_part( ‘content’, ‘header’ ); ?> <?php while ( have_posts() ) { … Read more

PHP Button Custom link [closed]

I’m not sure what byt_render_link_button() does, but I try this. <?php byt_render_field(“description clearfix”, “”, “”, $accommodation_description_html, ”, false, true); if (!empty($current_url) && $current_url == $list_user_accommodations_url) { byt_render_link_button($submit_accommodations_url . ‘?fesid=’ . $accommodation_id, “gradient-button clearfix”, “”, __(‘Edit’, ‘bookyourtravel’)); } else { byt_render_link_button( ‘http://www.mywebsite.com’, “gradient-button clearfix”, “”, __(‘Book now’, ‘bookyourtravel’) ); }

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