How To make the links for short code generate buttons nofollow?

resolved (9 posts) (2 voices)

  1. lossi
    Member

    Hi. I'm using the infocus theme and its really amazing. But I'm not quite sure how to make the 'button links' on blogposts, portfolio pages and the home page nofollow. Any help would be greatly appreciated. Since its a portfolio type site I'd love it keep any link juice.Thanks in advance.

    Lossi.

    Posted 4 months ago #
  2. Elliott
    Support

    Hello lossi,

    You can edit the button shortcode on line 122 in /wp-content/themes/[your_theme]/lib/shortcodes/02-buttons.php and add a rel = "nofollow".

    For the portfolio look on lines 312, 317, 658 and 663 in /wp-content/themes/[your_theme]/lib/shortcodes/15-portfolio.php.

    Posted 4 months ago #
  3. lossi
    Member

    Hi Elliot- Thanks for your reply.

    With regard to this message- "You can edit the button shortcode on line 122 in /wp-content/themes/[your_theme]/lib/shortcodes/02-buttons.php and add a rel = "nofollow".

    For the portfolio look on lines 312, 317, 658 and 663 in /wp-content/themes/[your_theme]/lib/shortcodes/15-portfolio.php."

    - I went to my wp-content folder for the themes- But i honestly don't know how or where to add the rel="nofollow" in the lines of code.
    I have the exact lines of code here and I would love if you could insert the rel="nofollow" in them exactly as it should be? ....As a complete newbie I would really appreciate this....
    Here are the Lines of code:

    (1) For the Buttons:

    $out = '<span>' . mysite_remove_wpautop( $content ) . '</span>';

    (2) For the Portfolio:
    Line 312: There is no code there- how to place the rel=nofollow (on the blank line?)

    Line 317: Where and how to put the code in this line?-
    $out .= ( $column != 1 ? '</div>' : '' );

    Line 658: Where and how to put the code in this line?-
    $out .= __( 'No portfolio posts were found for the category selected.', MYSITE_TEXTDOMAIN );

    Line 663: Where and how to put the code in this line? –
    remove_filter('post_limits', 'my_post_limit');

    (3) One last question- Will the placement of these nofollow tags be global-- That is will it automatically apply to a placement of buttons on all pages or portfolios including the home page automatically?

    Thanks in advance Elliot.. Looking forward to your reply as usual.
    Lossi.

    Posted 4 months ago #
  4. Elliott
    Support

    You need to add the rel = "nofollow" to your link so it looks like so,

    <a rel = "nofollow"></a>

    For example in the 02-buttons.php file you would change line 122 from this,

    $out = '<a href="' . esc_url( $link ) . '" class="button_link hover_fade' . $size . $target . $align . $variation . '"' . $style . '><span>' . mysite_remove_wpautop( $content ) . '</span></a>';

    To this,

    $out = '<a rel = "nofollow" href="' . esc_url( $link ) . '" class="button_link hover_fade' . $size . $target . $align . $variation . '"' . $style . '><span>' . mysite_remove_wpautop( $content ) . '</span></a>';

    As for the portfolio shortcode try lines 286, 291, 609, 613.

    Posted 4 months ago #
  5. lossi
    Member

    Hi there again Elliot. I implemented the "nofollow" on the button shortcode line (122). however, again I am running into some problems... I honestly don't know how to implement it in the portfolio shortcode lines you stated above.
    I was wondering if you can give me some help with this implementation in the following lines of code:

    Can you insert for me exactly how it should.....the "nofollow" attributes in the infocus Portfolio shortcode below?:

    Line 286: $out .= apply_filters( 'mysite_portfolio_date', '<p class="date">' . $_date[$id] . '</p>', array( 'column' => $column ) );
    Line 291- There is nothing on this line
    Line 609: $title = ( empty( $_more[$id][0] ) ) ? '' . get_the_title( $id ) . '' : get_the_title( $id );

    Line 613: else (there is just this word ‘else’ on the line.

    Thanks again Elliot.
    Lossi.

    Posted 4 months ago #
  6. lossi
    Member

    Sorry line 609 should be : $title = ( empty( $_more[$id][0] ) ) ? '' : get_the_title( $id );

    (the > was purposely left out after the ( $url ) . " ' so that you'll see the entire line.

    Posted 4 months ago #
  7. Elliott
    Support

    Line 286 looks like this,

    $read_more = '<a href="' . esc_url( $url ) . '" class="post_more_link">' . __( 'Read More', MYSITE_TEXTDOMAIN ) . '</a>&nbsp;&nbsp;';

    Change it like this,

    $read_more = '<a rel = "nofollow" href="' . esc_url( $url ) . '" class="post_more_link">' . __( 'Read More', MYSITE_TEXTDOMAIN ) . '</a>&nbsp;&nbsp;';

    Line 291 looks like this,

    $visit_site = '<a href="' . esc_url( $_link[$id] ) . '" class="post_more_link">' . __( 'Visit Site', MYSITE_TEXTDOMAIN ) . '</a>';

    Change it like this,

    $visit_site = '<a rel = "nofollow" href="' . esc_url( $_link[$id] ) . '" class="post_more_link">' . __( 'Visit Site', MYSITE_TEXTDOMAIN ) . '</a>';

    Do the same on lines 608 and 613.

    Posted 4 months ago #
  8. lossi
    Member

    I'm sorry Elliot... Something is definitely not adding up here..

    (1) First of all.... the snippets of code you provided are COMPLETELY DIFFERENT to that in my wp-content folder...All the lines of code you showed me how to modify are different to the ones I outlined above.

    (2) Previously you told me to insert the "nofollow" in line 609... However, in your latest response I see you put Line 608 instead....

    I'm not sure if things got mixed up along the way.

    Looking forward to resolving this issue.
    Thanks in advance.
    Lossi.

    Posted 4 months ago #
  9. Elliott
    Support

    608 or 609 it will look like this,

    $read_more = '<a href="' . esc_url( $url ) . '" class="post_more_link">' . __( 'Read More', MYSITE_TEXTDOMAIN ) . '</a>&nbsp;&nbsp;';

    Posted 4 months ago #

Reply

You must log in to post.

Construct WordPress Theme
Construct wordpress theme
Myriad WordPress Theme
Myriad wordpress theme
Method WordPress Theme
Method wordpress theme
Fusion WordPress Theme
Fusion wordpress theme
Elegance WordPress Theme
Elegance wordpress theme
Echelon WordPress Theme
Echelon wordpress theme
Dejavu WordPress Theme
Dejavu wordpress theme
Modular WordPress Theme
Modular wordpress theme