How to display thumbnail if post is assigned one otherwise not

you just need to clean up the if statement: <?php if ( has_post_thumbnail() ) { ?> <div class=”col-md-3″> <?php the_post_thumbnail(); ?> </div> <?php } ?> here’s the whole bit cleaned up: <?php query_posts(‘posts_per_page=1’) ?> <?php while ( have_posts() ) : the_post(); ?> <div class=”jumbotron”> <?php if ( has_post_thumbnail(); { )?> <div class=”col-md-3″> <?php the_post_thumbnail(); ?> … Read more

Loops in category description

What you want to do is to group fruits by color. In WordPress term appropriate mechanism for that is taxonomy (categories and tags are examples of taxonomy). I would create a custom taxonomy “fruit color” where terms would be individual colors and assigned to fruits. Then your display logic would be to: retrieve all fruit … Read more

ACF loop and php formatting

If it can be explicetly defined as the_title, then this should work for you: $pages = get_pages(array (‘sort_column’ => ‘menu_order’)); foreach ($pages as $page_data) { $fields = get_fields($page_data); if( $fields ) { echo ‘<div class=”the_title”>’ .$fields[‘the_title’] . ‘</div>’; echo ‘<div class=”container”>’; foreach( $fields as $field_name => $value ) { $field = get_field_object($field_name, false, array(‘load_value’ => … Read more

Buddypress Group Activity Loop Filter activity type [closed]

I have created this function in bp-custom.php page. function filtering_activity_default( $query ) { if ( empty( $query ) && empty( $_POST ) ) { $query = ‘action=activity_update,joined_group’; } return $query; } add_filter( ‘bp_ajax_querystring’, ‘filtering_activity_default’, 999 ); This is working for me as expected.

Need a conditional to test if title of parent page matches title of child page

solution here as function: function testchildren () { global $post; $childtest = get_pages(‘child_of=”.$post->ID); if( count( $childtest ) != 0 ) { return false; } else { return true; } } and implementation as markup: <?php if (have_posts()) : while (have_posts()) : the_post() ; ?> <h2><?php $parent_title = get_the_title($post->post_parent); echo $parent_title; ?> </h2> <?php if ( … Read more

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