WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] widget customization (4 posts)

  1. yoshid
    Member
    Posted 1 year ago #

    hi everyone,

    I have a wp template I am using for one of my projects. I'm having some issues customizing one of the widget.
    basically, the widget displays the post title, author and category. what I am trying to do is to have the widget show part of the actual post, a few lines at least.
    here is the piece of code I'm trying to modify:

    <h3>">
    <?php the_title(); ?>
    </h3>
    <p class="meta-info">
    <?php esc_html_e('Posted','Lucid'); ?>
    <?php esc_html_e('by','Lucid');?>
    <?php echo get_the_category_list(', '); ?>
    <?php esc_html_e('in','Lucid'); ?>
    <?php echo get_the_category_list(', '); ?>
    </p>

    is there a line of code I can add here to have part of my post show up in the widget? I tried adding: <?php the_post(); ?> but it kills the page entirely.

    any help would be greatly appreciate it. thanks in advance.
    yoshi /

  2. try <?php the_excerpt(); ?> instead. the_post() doesn't do what you're thinking it does.

  3. yoshid
    Member
    Posted 1 year ago #

    whoowhooo, that's the ticket.
    many thanks amy, much appreciated!
    p /

  4. You're welcome! I'm glad it worked for you.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.