vendredi 24 juin 2016

How to move the the_excerpt's read more link to another div in Wordpress

I intend to show an excerpt of each post on my homepage. I use the_excerpt() in my post.php to show an excerpt of each post with a read more button below it. The problem is that I need to have the readmore link in another div (the category metadata div) so that they are inline with each other. That way I can style them easily. So far, I have tried with no success to, first, strip the original the_excerpt's readmore link and then provide each post with another link in the other div.

The code in my post.php file:

<article <?php post_class(); ?> id="post-<?php the_ID(); ?>">
        <section>
                <?php get_template_part( 'templates/part', 'title' ); ?>
                <?php get_template_part( 'templates/part', 'postmetadata' ); ?>
                <?php if(has_post_thumbnail()) { ?>
                                <figure class="theme-post-media">
                                        <a><?php the_post_thumbnail( 'full', array( 'class' =>'img-responsive' ) ); ?></a>
                                </figure>
                <?php } ?>
                <?php the_excerpt(); ?>
        </section>
       <div class="postcatmeta">
                        <?php get_template_part( 'templates/part', 'postcatmeta' ); ?>
        </div>
</article>

Please kindly let me know if the above strategy is the right way to do so, and help me find the solution to this problem.

Thanks

UPDATE:

To remove the readme link, I had to use the_content() instead of the the_excerpt():

<?php the_content('', TRUE); ?>

Though I have gotten rid of the original readme link, I have no idea, how I can add a separate readme link for each post in front of the intended div.

Aucun commentaire:

Enregistrer un commentaire