Can this code be concatenated?
this is more a PHP question you can try these folowing forms : if (…) { echo ‘<p>’; get_template_part(‘templates/xxx’); echo ‘</p>’; } or if (…) { ?> <p> <?php get_template_part(‘templates/xxx’); ?> </p> <?php }
this is more a PHP question you can try these folowing forms : if (…) { echo ‘<p>’; get_template_part(‘templates/xxx’); echo ‘</p>’; } or if (…) { ?> <p> <?php get_template_part(‘templates/xxx’); ?> </p> <?php }
You can nest the singular and plural versions of the shortcode: [gravityforms action=”conditional” merge_tag=”{:3}” condition=”greater_than” value=”10″] [gravityform action=”conditional” merge_tag=”{:3}” condition=”less_than” value=”30″]Your value is greater than 10 less than 30[/gravityforms] [/gravityforms] More details on that here: https://gravitywiz.com/gravity-forms-conditional-shortcode/ – OR – You can use this snippet to create multiple conditions in a single shortcode: https://gist.github.com/spivurno/9db18385ed1d1f11a897bdfa8a1f2007 [gravityforms action=”conditional” … Read more
Count the brackets, you’ve got an extra one: // ↓ here if ( is_user_logged_in() & !is_admin() ) & !is_page(‘account’) ) { Also, you should use double ampersands in conditions like this. So: if ( is_user_logged_in() && !is_admin() && !is_page(‘account’) ) {
The restrict_manage_posts hook supplies the current post type as the very first parameter to the callback function (which is book_genre_filter_page() in your code), so you should use it (instead of the static $type variable in your code) to determine the current post type or to ensure your custom filter is displayed only on the admin … Read more
<?php // get the value of our custom field $meta_value = get_post_meta($post->ID, ‘ratings’, true); // if it’s not empty and the_ratings function exists: if( !empty($meta_value) && function_exists(‘the_ratings’) ){ the_ratings(); }
For the pingbacks ul & h2 you’ll have to move it inside your mytheme_comments function, which should be in your themes functions.php file. The tags are a bit easier, you just need to them inside the php: <?php the_tags(‘<div class=”postTags”>’,’ ‘,'<br /></div>’); ?> So it won’t show an empty div when there aren’t any tags.
If you are using a static page for your homepage. Then you should be using is_front_page();. Check this link -> http://codex.wordpress.org/Conditional_Tags
Assuming that you’re using parent page “photos” as a path. It’s good practice (and required by WordPress Theme Guidelines) to use body_class() function for output different classes, based on current page or post. Just insert this function in your theme. <body <?php body_class(); ?>> This function will add parent-pageid-(id) class on every child page, cause … Read more
If you mean a single post, not a page then use the conditional tag is_single() and check for this, like: function demo_link() { if ( is_single() && in_category( ‘themes’ ) ) { // Some code #1 } else { // Some code #2 } } add_action( ‘thesis_hook_after_post_box’, ‘demo_link’ ); If you will use it on … Read more
Remove the spaces in your else ifs such that they become elseifs. PHP interprets else if as though it were an if conditional nested within an else, and as such is expecting the else : to match your if : when it encounters else{ if(){} } instead. See 4661508 and 3385213 for more precise details … Read more