If is page, archive or search output this code
You can add OR conditions like this. <?php if ( is_front_page() || is_archive() || is_search() ) {?> <div>Flash Gordon</div> <?php } ?>
You can add OR conditions like this. <?php if ( is_front_page() || is_archive() || is_search() ) {?> <div>Flash Gordon</div> <?php } ?>
I would really suggest using one custom post type and one custom taxonomy with terms under the custom taxonomy which is assigned to a show. This structure will function exactly like normal posts with normal categories, the only difference is that it will be outside the scope of default blogging as custom post types are … Read more
You probably want this: <form action=”demo_form.php”> <textarea name=”blogpost” readonly=”readonly”> <?php the_content(); ?> </textarea> <input type=”submit” value=”Submit”> </form>
From your comments, this only happens when the fields are left empty. This means that the particular field does not get set. As stated in my comments, you should first check if a field is set before you try to use it. In the first block of code, you have the following three lines <td><input … Read more
Try just using the traditional $i iterator (untested) but I can’t see why this wouldn’t work.. <?php $i = 0; while ( have_posts() ) : the_post(); $i++; if ( $i == 1 ): ?> <!– First Post –> <div id=”post”> <a class=”post_image” href=”https://wordpress.stackexchange.com/questions/165568/<?php the_permalink(); ?>” title=”<?php the_title(); ?>”> <?php if ( has_post_thumbnail() ): ?> <?php … Read more
you can create new widget area. function header_widget_areas() { register_sidebar( array( ‘name’ => __( ‘header’, ‘header’ ), ‘id’ => ‘header’, ‘description’ => __( ‘Insert something for about us text.’, ‘header’ ), ‘before_widget’ => ‘<div class=”widget span3″>’, ‘after_widget’ => ‘</div>’, ‘before_title’ => ‘<h4>’, ‘after_title’ => ‘</h4>’, ) ); } add_action(‘widgets_init’, ‘header_widget_areas’); Then place your widget in … Read more
http://php.net/manual/en/function.preg-replace.php preg_replace expects your first parameter to be a pattern. Try a simple replace: $item = str_replace( array(‘.’,’ ‘), array(‘-‘,’-‘), strtolower($item));
You are returning the translation in your function, not printing it. Using <?php echo date_translation(); ?> should solve the problem. (given that functions.php is initiated at the time you use the function) Edit: In order to follow WordPress convention, you should call the function get_date_translation(). If you want the function to echo the result instead, … Read more
You can use get_field from ACF to check if the field is available and according to the documentation how you conditionally check if a field has contents. <div class=”wrapper”> <?php if (get_field(‘discount’)) { ?> <p>Discount: <?php the_field(‘discount’); ?></p> <?php } else { ?> <p>Price: <?php the_field(‘price’); ?></p> <?php } ?> </div><!–wrapper-end–> This should give you … Read more
Short, a new database table would be an absolute overkill. I think, what you want to do is pretty much resembling the existing menu_order column in wp_posts. Using post meta is just fine, but add it on the the singular staff member posts from your custom post type. So you will have several custom order … Read more