Adding shortcodes in wordpress php file

2019-08-15 05:14发布

问题:

Hello im running the wishlist member plugin in my wordpress site but it seems that it doesnt block the archives pages. What Im trying to do is use this 2 shortcodes so it blocks the content the it shows in the archive page. How can I add this open and close shortcodes to the php file below: [wlm_ismember] [/wlm_ismember]

This is the php code im using to put the shortcodes

<?php echo do_shortcode('[shortcode]');?

This is the file im working with, I want to put the [wlm_ismember] shortcode above <article <?php post_class(); ?>>, and [/wlm_ismember] below </article> so the article doesnt show.

<?php /* Loop Template used for index/archive/search */
$options = get_option('mh_options'); 
$excerpt_length = empty($options['excerpt_length']) ? '125' : $options['excerpt_length'];
?>

<?php echo do_shortcode('[wlm_ismember]');?>
<article <?php post_class(); ?>>
    <div class="loop-wrap clearfix">        
        <div class="loop-thumb">
            <a href="<?php the_permalink(); ?>">
                <?php if (has_post_thumbnail()) { the_post_thumbnail('loop'); } ?>
            </a>
        </div>
        <header class="loop-data">
            <h3 class="loop-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h3>
            <p class="meta"><a href="<?php the_permalink()?>" rel="bookmark"><?php $date = get_the_date(); echo $date; ?></a> // <?php comments_number(__('0 Comments', 'mh'), __('1 Comment', 'mh'), __('% Comments', 'mh')); ?></p>
        </header>
        <?php the_content(); ?>  
    </div>
</article>  
标签: php wordpress