• Resolved SchweizerSchoggi

    (@schweizerschoggi)


    [wpp stats_views=0 stats_date=1 stats_author=1 range='all' limit=1 cat='-5' excerpt_by_words=1 excerpt_length=20 thumbnail_width=350 thumbnail_height=250 wpp_start='<div class="brick_list">' wpp_end='</div>' post_html='<div class="brick_item" data-url="{url}"><div class="brick_item-image">{thumb_img}</div><div class="brick_item-header text-left">{dateandaction}<p>{tags}</p><h4><a class="blocklink" href="{url}">{text_title}</a></h4></div><div class="brick_item-body"><span class="wpp-excerpt">{summary}</span></div><div class="brick_item-footer"><div class="author_infobox">{avatar}<span class="author_name d-inline-block notranslate">{author}</span></div></div></div>']

    Dear Hector
    As you know (:-)) we are using your plugin inside the SA Slider plugin.
    In the slides, we have the code shown above.

    {avatar} and all the other placeholders are being resolved correctly, either by default or with additional code in the functions.php.

    But {author} is linking to an author page (but not to the website that is defined in the User setup in WP admin).

    How do I change the link? It should either link to the author website – or (even better) be removed at all, only displaying the author name, without linking anywhere.

    Can you help me with that?

    Thanks in advance and all the best,
    Bianca

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Hector Cabrera

    (@hcabrera)

    Hey @schweizerschoggi,

    Well, as you may know by now there’s no Content Tag that renders just the author name nor one to get their site’s URL. I may consider adding those in a future release though.

    For the time being you could try creating your own Content Tag, like so for example:

    /**
     * Parses custom content tags in WordPress Popular Posts.
     *
     * @param  string  $html    The HTML markup from the plugin.
     * @param  integer $post_id The post/page ID.
     * @return string
     */
    function wpp_parse_tags_in_popular_posts($html, $post_id) {
    
        // Replace custom content tag {custom_author} with
        // the author name
        if ( false !== strpos($html, '{custom_author}') ) {
            // Author display name
            $author_display_name = get_the_author_meta( 'display_name', get_post_field('post_author', $post_id) );
            // Replace {custom_author} with the author name
            $html = str_replace( '{custom_author}', $author_display_name, $html );
        }
    
        return $html;
    
    }
    add_filter('wpp_parse_custom_content_tags', 'wpp_parse_tags_in_popular_posts', 10, 2);

    Replace {author} with {custom_author} and you should see the author name without a link.

    Thread Starter SchweizerSchoggi

    (@schweizerschoggi)

    Awesome, as always!!
    More coffee is on it’s way ??

    Have a wonderful rest of your day, you helped me a lot (again)!
    Bianca

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Shortcode for author should contain no (or different) link’ is closed to new replies.