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

Issue in If else condition [closed]

Try to replace the following: <?php $sectyp = array( ‘meta_query’ => array( array( ‘key’ => ‘section_type’, // selecting the section type “Normal” or “Parallax” ‘value’ => ‘Parallax’ ), ), ); ?> with <?php $sectyp = get_post_meta(get_the_ID(), ‘section_type’, true); ?> and replace <?php if($sectyp) { ?> with <?php if($sectyp == “Parallax”) { ?>

How to display image on condition that a selection has been made

you can try this: if(get_field(‘activity_rating’) == “1”) { echo ‘path/to/image/onestar.jpg’; } elseif (get_field(‘activity_rating’) == “2”) { echo ‘path/to/image/twostar.jpg’; } elseif (get_field(‘activity_rating’) == “3”) { echo ‘path/to/image/threestar.jpg’; } elseif (get_field(‘activity_rating’) == “4”) { echo ‘path/to/image/fourstar.jpg’; } else (get_field(‘activity_rating’) == “5”) { echo ‘path/to/image/fivestar.jpg’; }