Sir, I made single page, call single-rental.php ` `

Hello Sir,

I made single page, call single-rental.php

<?php get_header(); ?>
<!-- Begin single.php -->
<?php get_sidebar( 'pagetop' ); ?>
<div class="wp-asia-content-layout"><div class="wp-asia-content-layout-row">
<?php get_sidebar(); ?>
<div class="wp-asia-layout-cell wp-asia-content">
<?php get_sidebar( 'contenttop' );

if ( have_posts() ) : the_post(); /* If we have a post, start the loop */

    get_template_part( 'content', 'single' );

else :
    get_template_part( 'content', '404' );
endif;
get_sidebar( 'contentbottom' ); ?>
</div>

</div></div>
<?php get_sidebar( 'pagebottom' ); ?>
<!-- End single.php -->
<?php get_footer(); ?>

And custom press Embed codes

<?php echo do_shortcode('[ct id="ct_Tahun_Mobi_text_7215" property="title | description | value"]'); ?>

and

<?php echo do_shortcode('[tax id="rental_katagori" before="your text before " separator=", " after=" your text after"]'); ?>

Where do i have to put shorcode ? because i try put in too loop, i have blank screen.

Please help me give an example, to put shortcode into my single page.

Thanks so much for helping.

  • Michelle Shull

    Hiya, Su!

    It's breaking because we need to stop and start PHP within the loop in order to make this work. Try this:

    <?php get_header(); ?>
    <!-- Begin single.php -->
    <?php get_sidebar( 'pagetop' ); ?>
    <div class="wp-asia-content-layout"><div class="wp-asia-content-layout-row">
    <?php get_sidebar(); ?>
    <div class="wp-asia-layout-cell wp-asia-content">
    <?php get_sidebar( 'contenttop' );

    if ( have_posts() ) : the_post(); ?>/* If we have a post, start the loop */

    <?php echo do_shortcode('[ct id="ct_Tahun_Mobi_text_7215" property="title | description | value"]'); ?>
    get_template_part( 'content', 'single' );

    else :
    get_template_part( 'content', '404' );
    endif;
    get_sidebar( 'contentbottom' ); ?>
    </div>

    </div></div>
    <?php get_sidebar( 'pagebottom' ); ?>
    <!-- End single.php -->
    <?php get_footer(); ?>

  • Michelle Shull

    Hiya, Su!

    It's breaking because we need to stop and start PHP within the loop in order to make this work. Try this:

    <?php get_header(); ?>
    <!-- Begin single.php -->
    <?php get_sidebar( 'pagetop' ); ?>
    <div class="wp-asia-content-layout"><div class="wp-asia-content-layout-row">
    <?php get_sidebar(); ?>
    <div class="wp-asia-layout-cell wp-asia-content">
    <?php get_sidebar( 'contenttop' );

    if ( have_posts() ) : the_post(); ?>/* If we have a post, start the loop */

    <?php echo do_shortcode('[ct id="ct_Tahun_Mobi_text_7215" property="title | description | value"]'); ?>
    get_template_part( 'content', 'single' );

    else :
    get_template_part( 'content', '404' );
    endif;
    get_sidebar( 'contentbottom' ); ?>
    </div>

    </div></div>
    <?php get_sidebar( 'pagebottom' ); ?>
    <!-- End single.php -->
    <?php get_footer(); ?>

  • Michelle Shull

    Hiya, Su!

    It's breaking because we need to stop and start PHP within the loop in order to make this work. Try this:

    <?php get_header(); ?>
    <!-- Begin single.php -->
    <?php get_sidebar( 'pagetop' ); ?>
    <div class="wp-asia-content-layout"><div class="wp-asia-content-layout-row">
    <?php get_sidebar(); ?>
    <div class="wp-asia-layout-cell wp-asia-content">
    <?php get_sidebar( 'contenttop' );
    
    if ( have_posts() ) : the_post(); ?>/* If we have a post, start the loop */
    
    <?php echo do_shortcode('[ct id="ct_Tahun_Mobi_text_7215" property="title | description | value"]'); ?>
    
    <?php echo do_shortcode('[tax id="rental_katagori" before="your text before " separator=", " after=" your text after"]'); ?>
    
    <?php   get_template_part( 'content', 'single' );
    
    else :
        get_template_part( 'content', '404' );
    endif;
    get_sidebar( 'contentbottom' ); ?>
    </div>
    
    </div></div>
    <?php get_sidebar( 'pagebottom' ); ?>
    <!-- End single.php -->
    <?php get_footer(); ?>

    Let us know if this doesn't work! (I visited this thread, Patrick's replies are very, very helpful! https://premium.wpmudev.org/forums/topic/error-creating-custom-post-type-template#post-530230)

  • Tyler Postle

    Hey Su,

    Hope you're doing well today and thanks for the link!

    If you want it underneath the title you will have to place it is in your content.php file I believe :slight_smile:

    Open it up and you will find lines somewhere like this:

    if ( is_single() ) :
    				the_title( '<h1 class="entry-title">', '</h1>' );
    			else :
    				the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' );
    			endif;

    Place that short code unerneath the "the_title" line.

    Your content.php might be slightly different to that but should still have the "the_title" call in there somewhere.

    Let us know if you need any further assistance Su!

    All the best,
    Tyler

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.