Site logo

Archived topic

Custom post type help

7 replies · Started by David on March 1, 2019

Viewing posts 1–8 of 8

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();

Hi there,

Try removing this line:

get_template_part( 'content', 'single' );

Let me know :)

Great, thanks Tom :)

You're welcome :)

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; ?>

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

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

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

This archived topic is closed to new replies.