WordPress.org

Ready to get started?Download WordPress

Forums

Automatically changing the permalink address to external link? (3 posts)

  1. kevintucker
    Member
    Posted 1 year ago #

    I need find a way to make the post excerpt/summary shown on the blog index link to an external site when finding a link in the post content.

    I've tried out the Page Links To plugin, which works great for manually updating the permalink of a post… but I need to find a way to make this happen automatically, by finding the URL from the post content and using it.

  2. kevintucker
    Member
    Posted 1 year ago #

    Anybody have an idea? Sorry to post just to bump… but I can't find another solution, and hoping someone has found a need to solve this problem and knows of a ready-made solution somewhere that I'm simply missing. Thanks!!

  3. joelogic
    Member
    Posted 1 year ago #

    Hi

    I used this, which makes the featured image a link to the external, though it doesn't work on some sites I have tried it on, (with same theme), could be a plugin conflict. Really slowed down one site I tried this on though.

    <?php $mypostimage = ''; if ( has_post_thumbnail() ) {
    $mypostimage = get_the_post_thumbnail($page->ID, 'summary-image', array('class' => 'photo' , 'alt' => get_the_title() , 'title' => get_the_title() ));
    } ?>
    <div class="storycontent"><?php echo apply_filters('the_content', preg_replace('/<img ([^>]*)>/', $mypostimage, get_the_content())); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic