F
F
foxayb2018-03-16 01:11:56
WordPress
foxayb, 2018-03-16 01:11:56

How to fit large code into a word for easy insertion into php?

Tell me, please:
Is there any code, well, for example:

<div class="post-meta-top entry-meta">
      <div class="row">
        <?php if(is_rtl()): ?>
          <div class="col-md-6">
            <?php echo get_the_category_list(); ?>
            <?php the_tags('<ul class="post-tags"><li>','</li><li>','</li></ul>'); ?>
          </div>
          <div class="col-md-6">
            <div class="post-date"><?php _e('Posted on', 'pluto'); ?> <time class="entry-date updated" datetime="<?php echo get_the_date( 'c' ); ?>"><?php echo get_the_date(); ?></time></div>
            <div class="post-author"><strong class="author vcard"><a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) )) ; ?>" class="url fn n" rel="author"><?php echo get_the_author(); ?></a></strong> <?php _e('by', 'pluto'); ?></div>
          </div>
        <?php else: ?>
          <div class="col-md-6 p-data-author">
            <div class="post-date"><?php _e('Posted on', 'pluto'); ?> <time class="entry-date updated" datetime="<?php echo get_the_date( 'c' ); ?>"><?php echo get_the_date(); ?></time></div>
            <div class="post-author"><?php _e('by', 'pluto'); ?> <strong class="author vcard"><a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) )) ; ?>" class="url fn n" rel="author"><?php echo get_the_author(); ?></a></strong></div>
          </div>
          <div class="col-md-6 p-cat-tag">
            <?php the_tags('<ul class="post-tags"><li>','</li><li>','</li></ul>'); ?>
            <?php echo get_the_category_list(); ?>
          </div>
        <?php endif; ?>
      </div>
    </div>

Is it possible somehow to drive it into one word, for example: etotcode and then not to constantly insert the code above, but only the word etotcode
like this: <?php etotcode(); ?>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stalker_RED, 2018-03-16
@foxayb

include or require doesn't work?

V
Vladimir Skibin, 2018-03-16
@megafax

php.net/ob_start + php.net/ob_get_clean
And not a word, but a variable.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question