[Resolved] Custom post type help

Home Forums Support [Resolved] Custom post type help

Home Forums Support Custom post type help

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #825726
    David

    Hello,

    I’ve set up a custom post type called locations.

    I’ve then copied the single page and called it single-locations.php.

    How do I remove the <article></article> content box – its just a big white space that sits above the image slider at the moment…

    http://185.20.51.60/~hiremarqueeco/locations/hampshire/

    The page consists of this…

    <?php
    /**
    * The Template for displaying all single posts.
    *
    * @package GeneratePress
    */

    if ( ! defined( ‘ABSPATH’ ) ) {
    exit; // Exit if accessed directly.
    }

    get_header(); ?>

    >
    <main id=”main” <?php generate_do_element_classes( ‘main’ ); ?>>
    <?php
    /**
    * generate_before_main_content hook.
    *
    * @since 0.1
    */
    do_action( ‘generate_before_main_content’ );

    while ( have_posts() ) : the_post();

    get_template_part( ‘content’, ‘single’ );

    // If comments are open or we have at least one comment, load up the comment template.
    if ( comments_open() || ‘0’ != get_comments_number() ) :
    /**
    * generate_before_comments_container hook.
    *
    * @since 2.1
    */
    do_action( ‘generate_before_comments_container’ );
    ?>

    <?php comments_template(); ?>

    <?php
    endif;

    endwhile;

    /**
    * generate_after_main_content hook.
    *
    * @since 0.1
    */
    do_action( ‘generate_after_main_content’ );
    ?>
    </main><!– #main –>

    <!– #primary –>

    <?php
    /**
    * generate_after_primary_content_area hook.
    *
    * @since 2.0
    */
    do_action( ‘generate_after_primary_content_area’ );

    generate_construct_sidebars();

    get_footer();

    #826016
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Try removing this line:

    get_template_part( 'content', 'single' );

    Let me know πŸ™‚

    #828026
    David

    Great, thanks Tom πŸ™‚

    #828556
    Tom
    Lead Developer
    Lead Developer

    You’re welcome πŸ™‚

    #828566
    David

    On a seperate note, can you please help with this…

    Basically Im trying to show content on the frontend depending on a option selected in ACF, like this…
    https://thenorthernfoundry.com/acf-conditional-radio-buttons-options-page/

    I’ve set up a radio button with the options yes and no and the field name terms_box , so if they select yes in the back end it should then show yes the content, if they select no it should show the no content. I’ve got this but not working…

    <?php if(get_field(‘terms_box’, ‘option’) == ‘yes’) : ?>

    <p>YES TEXT</p>

    <?php elseif(get_field(‘terms_box’, ‘option’) == ‘no’) : ?>

    <p>NO TEXT</p>

    <?php else : ?>
    <!– Do nothing –>
    <?php endif; ?>

    #828877
    Tom
    Lead Developer
    Lead Developer

    That code looks right, at least according to that documentation. Have you checked with ACF?

    #829141
    David

    Yea, didn’t get anything back – I think because it’s in a repeater field that is why it isn’t working.

    #829710
    Tom
    Lead Developer
    Lead Developer

    In that case you would likely need to implement a foreach() to output each item inside the repeater field.

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.