ACF field not appearing correctly in loop

Insert the post ID in the_field function. See the documentation. <?php the_field($field_name, $post_id); ?> $field_name: the name of the field to be retrieved. eg “page_content” (required) $post_id: Specific post ID where your value was entered. Defaults to current post ID (not required). This can also be options / taxonomies / users / etc So in … Read more

Displaying page list and a custom field

From what I see there, I’d expect that your problem is the meta value in story_detail_story_image is storing an image id. Try replacing the following <?php if ( get_post_meta( get_the_ID(), ‘story_detail_story_image’, true ) ) : ?> <a href=”https://wordpress.stackexchange.com/questions/177610/<?php the_permalink() ?>” rel=”bookmark”> <img class=”thumb” src=”<?php echo get_post_meta( get_the_ID(), ‘story_detail_story_image’, true ); ?>” alt=”<?php the_title(); ?>” /> … Read more

Can’t get the_content to show

You never start the main loop: <?php if (have_posts()) : ?> <h1 class=”pricing”>Prices</h1> <h2><?php the_title(); ?></h2> <?php the_content(); ?> You check if there are posts in the main query, but you never start the loop, and jump straight to showing the title and content, you need to move everything into a main post loop. Without … 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”) { ?>

Advanced Custom Fields – Add Field to Specific Page [closed]

You have two options. Either use get_field or the_field. get_field just reads out the field from the db without and screenoutput. like you did in your first line: $fields = get_field(‘testimonial’); the_field instead is get_field with an implied echo. <?php the_field(‘testimonial’); ?> so basically the_field would be enough. Aside you have to write a wp_query … Read more

How to show amount of post in a taxonomy with advanced custom fields?

You can use this code for getting number of posts in a taxonomy: $args = array( ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => -1, ‘tax_query’ => array( array( ‘taxonomy’ => ‘your-taxonomy-name’, ‘field’ => ‘slug’, ‘terms’ => ‘some-slug’, ) ) ); $query = new WP_Query( $args ); echo $query->post_count;

How do I use “while” and “end while” inside of the echo do_shortcode with ACF Repeater?

You need to generate the shortcode within the loop, and then execute it afterwards: if ( have_rows( ‘homepage_slider’ ) ) { $shortcode=”[ux_slider timer=”4500″ arrows=”true” bullets=”true” auto_slide=”true” nav_color=”light”]”; while ( have_rows(‘homepage_slider’) ) { the_row(); $shortcode .= ‘[ux_banner bg=” ‘ . get_sub_field( ‘slider_image’ ) . ‘ ” height=”600px” text_color=”light” text_align=”center” text_pos=”center” text_width=”70%” parallax_text=”0″ parallax=”3″ effect=”sparkle”] <h1>’ . … Read more

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