Help with if else statement for separating content from image attachment

Technically, this should work: <!–display image–> <div class=”featured-image”> <?php $args = array( ‘post_type’ => ‘attachment’, ‘numberposts’ => -1, ‘post_status’ => null, ‘post_parent’ => $post->ID ); $attachments = get_posts( $args ); if ( $attachments ) { foreach ( $attachments as $attachment ) { echo wp_get_attachment_image( $attachment->ID, ‘full’ ); } } ?> </div> <?php $content = preg_replace(‘/<img[^>]+./’,”,get_the_content()); … Read more

Php conditional help needed

This post is related to php so you should post it in stackoverflow but as you are a new user .i would help you <?php if (is_author(‘2’) && (is_single()) ) { ?> <link rel=”author” href=”https://plus.google.com/**********”/> <?php } ?>

Give a condition to a wordpress menu item to change its offerid for each landing page I create

What about using jQuery to insert the unique code to your CTA menu class or item ID? Something like: // generate your unique codes in jQuery var mycode = your_random_code_function() // or an array of codes // then… var myhref = $(“body.landingpage .navbar-nav .cta a”).attr(“href”); $(“body.landingpage .navbar-nav .cta a”).attr(“href”, myhref + “?offerid=” + mycode); // … Read more

If statement to check for post_content

The following line is wrong <?php echo get_post_meta($partner->ID, $a_description, true); ?> If you look closely, you are actually passing get_post_meta($partner->ID, “a_description”) to the $key parameter of get_post_meta as this is the value assigned to $a_description You should most probably change $a_description to just a_description EDIT This line <?php echo get_post_meta($partner->ID, $a_description, true); ?> should most … Read more

Different titles for static, posts, and every xy page

Ok solved. <?php if ( is_front_page() && !is_home() ) :?> <h1><a href=”https://wordpress.stackexchange.com/questions/175971/<?php echo esc_url( home_url(“https://wordpress.stackexchange.com/” ) ); ?>” rel=”home”><?php bloginfo( ‘name’ ); ?></a></h1> <?php elseif ( is_home() && get_option(‘page_for_posts’) ): ?> <h1><?php echo apply_filters(‘the_title’,get_page( get_option(‘page_for_posts’) )->post_title); ?></h1> <?php else : ?> <h1><a href=”<?php echo get_permalink() ?>” rel=”bookmark” title=”<?php the_title(); ?>”><?php the_title(”); ?></a></h1> <?php endif; ?> … Read more

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