0

Hello, I wold like to add a check-box or button to have a choice between hide or display featured image in single post. i'm in wordpress 5.0.2

This is the code of my simple single.php in the theme :

<!-- START ARTICLE -->
<section class="article clearfix">

  <div class="head_seangle">
    <h1><?php the_title();?></h1>
  </div><!-- head_seangle -->
  <?php ap_ads_thumb(); ?>
  <div class="med">
  <?php if (get_post_meta(get_the_ID(), 'ap_video_embed', true)) : ?>
    <div class="embed-responsive embed-responsive-16by9">
      <?php echo get_post_meta(get_the_ID(), 'ap_video_embed', true); ?>
    </div>
  <?php elseif(ap_option('onf_sthumb')):?>
    <div class="thumbnail">
      <?php 
        if ( has_post_thumbnail() ) { 
          the_post_thumbnail( 'bg' );
        } else {
          echo '<img alt="AisPanel" title="AisPanel" src="https://placeholdit.imgix.net/~text?txtsize=20&bg=eee&txtclr=8C8C8C%26text%3Dthree&txt=ap&w=728&h=300">';
        } 
        ?>
    </div>
  <?php endif;?>
</div><!-- med -->
<?php ap_ads_bthumb(); ?>
      <div class="conteneur_barre_outils">
    <div class="bloc_signature">
      <?php if(ap_option('onf_author')){ ?>
      <span class="edt"><?php the_author_posts_link(); ?> </span>
      <?php };?>
      <?php if(ap_option('onf_dtime')){ ?>
      <span class="time"><?php the_time('j F Y') ?> - <?php the_time('G:i'); ?></span>
      <?php };?>
    </div><!-- bloc -->
    <?php if(ap_option('onf_share')){ ?>
    <span class="soc">
      <?php if(!wp_is_mobile()){ ?>
      <span>مشاركة</span>
      <?php } ?>
      <?php if(ap_option('onf_print') && !wp_is_mobile()){ ?>
        <a class="print" href="#" onclick="window.print();" class="print ar"><i class="fal fa-print"></i></a>
      <?php };?>
      <a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo get_permalink( get_the_ID() )?>"  onclick="javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=250,width=600');return false;"class="fab fa-facebook"></a>
      <a href="https://twitter.com/intent/tweet?text=<?php echo get_permalink( get_the_ID() )?>" onclick="javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=250,width=600');return false;" class="fab fa-twitter"></a>
      <a href="https://plus.google.com/share?url=<?php echo get_permalink( get_the_ID() )?>"  onclick="javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=250,width=600');return false;"class="fab fa-google"></a>
      <a href="whatsapp://send?text=<?php echo get_permalink( get_the_ID() )?>" data-action="share/whatsapp/share" class="fab fa-whatsapp"></a>
    </span>
    <?php };?>
  </div><!-- conteneur_barre_outils -->
  <div id="entry">
    <div class="entry">
      <?php the_content();
      ap_ads_bpost();
      ?>
    </div>
  </div><!-- entry -->
  <?php if(ap_option('onf_stags')) the_tags('<div class="post_tags">', ' ', '</div>'); ?>
</section><!-- article -->
    <!-- END ARTICLE -->

<!--<?php if(ap_option('onf_repost')){ ?>
<div class="moreposts">
  <div class="t"><h4>مقالات ذات صلة</h4></div>
  <div class="postlist">

    <?php
    $z=0;
    $categories = get_the_category($post->ID);
    if ($categories) :
      $category_ids = array();
      foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;
      $args=array(
        'category__in' => $category_ids,
        'post__not_in' => array($post->ID),
        'orderby'=> 'ASC',
        'showposts'=> ap_option('repost_count'),
      );
      $my_query = new WP_Query($args);
      if( $my_query->have_posts() ) :
        while ($my_query->have_posts()) : $my_query->the_post();$z++;
          get_template_part( 'templates/content', get_post_format() );
        endwhile; endif ;endif; wp_reset_query();?>
      </div>
    </div>
    <?php };?>-->



    <?php 
    if ( comments_open() || get_comments_number() ) :
      comments_template();
    endif;
    ?>


  <?php endwhile; ?>
</div>

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.