Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #120730
    Jordan B
    Participant

    Is it possible to make rows nofollow?

    Ex: The links to articles in a recent posts row.

    Could I make that nofollow?

    #120798
    Kosher K
    Member

    Hi Jordan,

    Would you mind providing url of your site for us to check?

    Thank you

    #121247
    Jordan B
    Participant

    gamerapproved (dot) com

    #121573
    Nabeel A
    Moderator

    Hi Jordan,

    Thank you for providing us the URL! Regretfully, at this time I am not entirely certain what it is you would like to accomplish based on the information given in your post. If you wouldn’t mind providing us with a little more clarification on what it is you’re wanting to do (a link to a similar example site would be very helpful, or perhaps some screenshots), we’ll be happy to provide you with a response once we have a better understanding of the situation.

    #121732
    Jordan B
    Participant

    http://scratch99.com/wp-content/uploads/2012/10/limiting-links-header.jpg

    I would like to make the other links on my homepage nofollow so search engines focus on my navigation bar.

    Links such as
    – My buttons
    – Links to my recent posts

    #122101
    Zeshan
    Member

    Hi Jordan,

    Thank you for writing in!

    It can be done with custom development, but regretfully, it will fall beyond the scope of support we can offer at this time as it will require a lot of template customization. You may wish to consult a developer, or a service like WerkPress or Elto to assist you with this. X is quite extensible with child themes, so there are plenty of possibilities.

    Meanwhile, just to make [recent_posts] links nofollow, you can add the following code in your child theme’s functions.php file:

    // Recent Posts = No follow links
    // =============================================================================
    
    function x_shortcode_recent_posts_links_nofollow( $atts ) {
      extract( shortcode_atts( array(
        'id'          => '',
        'class'       => '',
        'style'       => '',
        'type'        => '',
        'count'       => '',
        'category'    => '',
        'offset'      => '',
        'orientation' => '',
        'no_image'    => '',
        'fade'        => ''
      ), $atts ) );
    
      $id            = ( $id          != ''          ) ? 'id="' . esc_attr( $id ) . '"' : '';
      $class         = ( $class       != ''          ) ? 'x-recent-posts cf ' . esc_attr( $class ) : 'x-recent-posts cf';
      $style         = ( $style       != ''          ) ? 'style="' . $style . '"' : '';
      $type          = ( $type        == 'portfolio' ) ? 'x-portfolio' : 'post';
      $count         = ( $count       != ''          ) ? $count : 3;
      $category      = ( $category    != ''          ) ? $category : '';
      $category_type = ( $type        == 'post'      ) ? 'category_name' : 'portfolio-category';
      $offset        = ( $offset      != ''          ) ? $offset : 0;
      $orientation   = ( $orientation != ''          ) ? ' ' . $orientation : ' horizontal';
      $no_image      = ( $no_image    == 'true'      ) ? $no_image : '';
      $fade          = ( $fade        == 'true'      ) ? $fade : 'false';
    
      $output = "<div {$id} class=\"{$class}{$orientation}\" {$style} data-fade=\"{$fade}\">";
    
        $q = new WP_Query( array(
          'orderby'          => 'date',
          'post_type'        => "{$type}",
          'posts_per_page'   => "{$count}",
          'offset'           => "{$offset}",
          "{$category_type}" => "{$category}"
        ) );
    
        if ( $q->have_posts() ) : while ( $q->have_posts() ) : $q->the_post();
    
          if ( $no_image == 'true' ) {
            $image_output       = '';
            $image_output_class = 'no-image';
          } else {
            $image_output       = '<div class="x-recent-posts-img">' . get_the_post_thumbnail( get_the_ID(), 'entry-' . x_get_option( 'x_stack', 'integrity' ) . '-cropped', NULL ) . '</div>';
            $image_output_class = 'with-image';
          }
    
          $output .= '<a rel="nofollow" class="x-recent-post' . $count . ' ' . $image_output_class . '" href="' . get_permalink( get_the_ID() ) . '" title="' . esc_attr( sprintf( __( 'Permalink to: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ) . '">'
                     . '<article id="post-' . get_the_ID() . '" class="' . implode( ' ', get_post_class() ) . '">'
                       . '<div class="entry-wrap">'
                         . $image_output
                         . '<div class="x-recent-posts-content">'
                           . '<h3 class="h-recent-posts">' . get_the_title() . '</h3>'
                           . '<span class="x-recent-posts-date">' . get_the_date() . '</span>'
                         . '</div>'
                       . '</div>'
                     . '</article>'
                   . '</a>';
    
        endwhile; endif; wp_reset_postdata();
      
      $output .= '</div>';
    
      return $output;
    }
    
    add_filter('init', function() {
       remove_shortcode( 'recent_posts' );
    
       add_shortcode( 'recent_posts', 'x_shortcode_recent_posts_links_nofollow' );
    });
    

    Thanks for understanding. Take care!

    #122183
    Jordan B
    Participant

    Thanks, that’s perfect.

    Is there any way to apply this to the buttons?

    #122416
    Zeshan
    Member

    Hi Jordan,

    You can add the following code for buttons shortcode:

    // Buttons
    // =============================================================================
    
    function x_shortcode_button2( $atts, $content = null ) {
      extract( shortcode_atts( array(
        'id'               => '',
        'class'            => '',
        'style'            => '',
        'type'             => '',
        'shape'            => '',
        'size'             => '',
        'float'            => '',
        'block'            => '',
        'circle'           => '',
        'icon_only'        => '',
        'href'             => '',
        'title'            => '',
        'target'           => '',
        'info'             => '',
        'info_place'       => '',
        'info_trigger'     => '',
        'info_content'     => '',
        'lightbox_thumb'   => '',
        'lightbox_video'   => '',
        'lightbox_caption' => ''
      ), $atts ) );
    
      $id    = ( $id    != '' ) ? 'id="' . esc_attr( $id ) . '"' : '';
      $class = ( $class != '' ) ? ' ' . esc_attr( $class ) : '';
      $style = ( $style != '' ) ? 'style="' . $style . '"' : '';
      $type  = ( $type  != '' ) ? ' x-btn-' . $type : '';
      $shape = ( $shape != '' ) ? ' x-btn-' . $shape : '';
      $size  = ( $size  != '' ) ? ' x-btn-' . $size : '';
      switch ( $float ) {
        case 'left' :
          $float = ' alignleft';
          break;
        case 'right' :
          $float = ' alignright';
          break;
        default :
          $float = '';
      }
      $block            = ( $block            == 'true'  ) ? ' x-btn-block' : '';
      $icon_only        = ( $icon_only        == 'true'  ) ? ' x-btn-icon-only' : '';
      $href             = ( $href             != ''      ) ? $href : '#';
      $title            = ( $title            != ''      ) ? 'title="' . $title . '"' : '';
      $target           = ( $target           == 'blank' ) ? 'target="_blank"' : '';
      $info             = ( $info             != ''      ) ? 'data-toggle="' . $info . '"' : '';
      $info_place       = ( $info_place       != ''      ) ? 'data-placement="' . $info_place . '"' : '';
      $info_trigger     = ( $info_trigger     != ''      ) ? 'data-trigger="' . $info_trigger . '"' : '';
      $info_content     = ( $info_content     != ''      ) ? 'data-content="' . $info_content . '"' : '';
      $lightbox_thumb   = ( $lightbox_thumb   != ''      ) ? $lightbox_thumb : '';
      $lightbox_video   = ( $lightbox_video   == 'true'  ) ? ', width: 1080, height: 608' : '';
      $lightbox_caption = ( $lightbox_caption != ''      ) ? 'data-caption="' . $lightbox_caption . '"' : '';
    
      if ( is_numeric( $lightbox_thumb ) ) {
        $lightbox_thumb_info = wp_get_attachment_image_src( $lightbox_thumb, 'full' );
        $lightbox_thumb      = $lightbox_thumb_info[0];
      }
    
      if ( $lightbox_video != '' ) {
        $lightbox_options = "data-options=\"thumbnail: '" . $lightbox_thumb . "'{$lightbox_video}\"";
      } else {
        $lightbox_options = "data-options=\"thumbnail: '" . $lightbox_thumb . "'\"";
      }
    
      if ( $circle == 'true' ) {
        $output = "<div {$id} class=\"x-btn-circle-wrap{$size}{$block}{$float}\" {$style}><a class=\"x-btn{$class}{$type}{$shape}{$size}{$block}{$icon_only}\" href=\"{$href}\" rel=\"nofollow\" {$title} {$target} {$info} {$info_place} {$info_trigger} {$info_content} {$lightbox_caption} {$lightbox_options}>" . do_shortcode( $content ) . "</a></div>";
      } else {
        $output = "<a {$id} class=\"x-btn{$class}{$type}{$shape}{$size}{$block}{$float}{$icon_only}\" {$style} href=\"{$href}\" rel=\"nofollow\" {$title} {$target} {$info} {$info_place} {$info_trigger} {$info_content} {$lightbox_caption} {$lightbox_options}>" . do_shortcode( $content ) . "</a>";
      }
      
      return $output;
    }
    
    add_filter('init', function() {
       remove_shortcode( 'button' );
    
       add_shortcode( 'button', 'x_shortcode_button2' );
    });
    

    Further customizations from here would be getting into custom development, which is outside the scope of support we can offer. If you need more in depth changes, you may wish to consult with a developer, or look into service like Elto or WerkPress. X is quite extensible with child themes, so there are plenty of possibilities.

    Thanks for understanding.

    #122494
    Jordan B
    Participant

    Those two things were actually just the things I needed, thank you!

    #122560
    Kosher K
    Member

    Glad to hear that Jordan.

    Cheers

    #381183
    Bart971
    Participant

    Sorry to bump an old thread, I’m also looking for a way to add nofollow into buttons. I tried to add the code you provided to x-child/functions.php file:

    // Buttons
    // =============================================================================
    
    function x_shortcode_button2( $atts, $content = null ) {
      extract( shortcode_atts( array(
        'id'               => '',
        'class'            => '',
        'style'            => '',
        'type'             => '',
        'shape'            => '',
        'size'             => '',
        'float'            => '',
        'block'            => '',
        'circle'           => '',
        'icon_only'        => '',
        'href'             => '',
        'title'            => '',
        'target'           => '',
        'info'             => '',
        'info_place'       => '',
        'info_trigger'     => '',
        'info_content'     => '',
        'lightbox_thumb'   => '',
        'lightbox_video'   => '',
        'lightbox_caption' => ''
      ), $atts ) );
    
      $id    = ( $id    != '' ) ? 'id="' . esc_attr( $id ) . '"' : '';
      $class = ( $class != '' ) ? ' ' . esc_attr( $class ) : '';
      $style = ( $style != '' ) ? 'style="' . $style . '"' : '';
      $type  = ( $type  != '' ) ? ' x-btn-' . $type : '';
      $shape = ( $shape != '' ) ? ' x-btn-' . $shape : '';
      $size  = ( $size  != '' ) ? ' x-btn-' . $size : '';
      switch ( $float ) {
        case 'left' :
          $float = ' alignleft';
          break;
        case 'right' :
          $float = ' alignright';
          break;
        default :
          $float = '';
      }
      $block            = ( $block            == 'true'  ) ? ' x-btn-block' : '';
      $icon_only        = ( $icon_only        == 'true'  ) ? ' x-btn-icon-only' : '';
      $href             = ( $href             != ''      ) ? $href : '#';
      $title            = ( $title            != ''      ) ? 'title="' . $title . '"' : '';
      $target           = ( $target           == 'blank' ) ? 'target="_blank"' : '';
      $info             = ( $info             != ''      ) ? 'data-toggle="' . $info . '"' : '';
      $info_place       = ( $info_place       != ''      ) ? 'data-placement="' . $info_place . '"' : '';
      $info_trigger     = ( $info_trigger     != ''      ) ? 'data-trigger="' . $info_trigger . '"' : '';
      $info_content     = ( $info_content     != ''      ) ? 'data-content="' . $info_content . '"' : '';
      $lightbox_thumb   = ( $lightbox_thumb   != ''      ) ? $lightbox_thumb : '';
      $lightbox_video   = ( $lightbox_video   == 'true'  ) ? ', width: 1080, height: 608' : '';
      $lightbox_caption = ( $lightbox_caption != ''      ) ? 'data-caption="' . $lightbox_caption . '"' : '';
    
      if ( is_numeric( $lightbox_thumb ) ) {
        $lightbox_thumb_info = wp_get_attachment_image_src( $lightbox_thumb, 'full' );
        $lightbox_thumb      = $lightbox_thumb_info[0];
      }
    
      if ( $lightbox_video != '' ) {
        $lightbox_options = "data-options=\"thumbnail: '" . $lightbox_thumb . "'{$lightbox_video}\"";
      } else {
        $lightbox_options = "data-options=\"thumbnail: '" . $lightbox_thumb . "'\"";
      }
    
      if ( $circle == 'true' ) {
        $output = "<div {$id} class=\"x-btn-circle-wrap{$size}{$block}{$float}\" {$style}><a class=\"x-btn{$class}{$type}{$shape}{$size}{$block}{$icon_only}\" href=\"{$href}\" rel=\"nofollow\" {$title} {$target} {$info} {$info_place} {$info_trigger} {$info_content} {$lightbox_caption} {$lightbox_options}>" . do_shortcode( $content ) . "</a></div>";
      } else {
        $output = "<a {$id} class=\"x-btn{$class}{$type}{$shape}{$size}{$block}{$float}{$icon_only}\" {$style} href=\"{$href}\" rel=\"nofollow\" {$title} {$target} {$info} {$info_place} {$info_trigger} {$info_content} {$lightbox_caption} {$lightbox_options}>" . do_shortcode( $content ) . "</a>";
      }
      
      return $output;
    }
    
    add_filter('init', function() {
       remove_shortcode( 'button' );
    
       add_shortcode( 'button', 'x_shortcode_button2' );
    });

    then I uploaded and installed the x-child containing the modified functions.php files but nothing changed. My button doesn’t have the nofollow attribute…

    Does I need to do anything else?

    Thanks in advance
    Regards

    #381226
    Zeshan
    Member

    Hi there,

    Please use this code instead for buttons:

    function x_shortcode_button2( $atts, $content = null ) {
      extract( shortcode_atts( array(
        'id'               => '',
        'class'            => '',
        'style'            => '',
        'type'             => '',
        'shape'            => '',
        'size'             => '',
        'float'            => '',
        'block'            => '',
        'circle'           => '',
        'icon_only'        => '',
        'href'             => '',
        'title'            => '',
        'target'           => '',
        'info'             => '',
        'info_place'       => '',
        'info_trigger'     => '',
        'info_content'     => '',
        'lightbox_thumb'   => '',
        'lightbox_video'   => '',
        'lightbox_caption' => ''
      ), $atts, 'x_button' ) );
    
      $id    = ( $id    != '' ) ? 'id="' . esc_attr( $id ) . '"' : '';
      $class = ( $class != '' ) ? ' ' . esc_attr( $class ) : '';
      $style = ( $style != '' ) ? 'style="' . $style . '"' : '';
      $type  = ( $type  != '' ) ? ' x-btn-' . $type : '';
      $shape = ( $shape != '' ) ? ' x-btn-' . $shape : '';
      $size  = ( $size  != '' ) ? ' x-btn-' . $size : '';
      switch ( $float ) {
        case 'left' :
          $float = ' alignleft';
          break;
        case 'right' :
          $float = ' alignright';
          break;
        default :
          $float = '';
      }
      $block            = ( $block            == 'true'  ) ? ' x-btn-block' : '';
      $icon_only        = ( $icon_only        == 'true'  ) ? ' x-btn-icon-only' : '';
      $href             = ( $href             != ''      ) ? $href : '#';
      $title            = ( $title            != ''      ) ? 'title="' . $title . '"' : '';
      $target           = ( $target           == 'blank' ) ? 'target="_blank"' : '';
      $lightbox_thumb   = ( $lightbox_thumb   != ''      ) ? $lightbox_thumb : '';
      $lightbox_video   = ( $lightbox_video   == 'true'  ) ? ', width: 1080, height: 608' : '';
      $lightbox_caption = ( $lightbox_caption != ''      ) ? 'data-caption="' . $lightbox_caption . '"' : '';
    
      $tooltip_attr = ( $info != '' ) ? cs_generate_data_attributes_extra( $info, $info_trigger, $info_place, '', $info_content ) : '';
    
      if ( is_numeric( $lightbox_thumb ) ) {
        $lightbox_thumb_info = wp_get_attachment_image_src( $lightbox_thumb, 'full' );
        $lightbox_thumb      = $lightbox_thumb_info[0];
      }
    
      if ( $lightbox_video != '' ) {
        $lightbox_options = "data-options=\"thumbnail: '" . $lightbox_thumb . "'{$lightbox_video}\"";
      } else {
        $lightbox_options = "data-options=\"thumbnail: '" . $lightbox_thumb . "'\"";
      }
    
      if ( $circle == 'true' ) {
        $output = "<div {$id} class=\"x-btn-circle-wrap{$size}{$block}{$float}\" {$style}><a rel=\"nofollow\" class=\"x-btn{$class}{$type}{$shape}{$size}{$block}{$icon_only}\" href=\"{$href}\" {$title} {$target} {$tooltip_attr} {$lightbox_caption} {$lightbox_options}>" . do_shortcode( $content ) . "</a></div>";
      } else {
        $output = "<a {$id} rel=\"nofollow\" class=\"x-btn{$class}{$type}{$shape}{$size}{$block}{$float}{$icon_only}\" {$style} href=\"{$href}\" {$title} {$target} {$tooltip_attr} {$lightbox_caption} {$lightbox_options}>" . do_shortcode( $content ) . "</a>";
      }
    
      return $output;
    }
    
    add_filter('init', function() {
      remove_shortcode( 'x_button' );
      add_shortcode( 'x_button', 'x_shortcode_button2' );
    });
    

    Thanks!

    #381245
    Bart971
    Participant

    Awesome, this code works! Thanks a lot!

    Best regards

    #381250
    Nico
    Moderator

    Glad to hear that it worked.

    Have a great day! 🙂

    #845963
    UHeuer
    Participant

    I am new at WordPress and the x-theme. Can you give me an instruction where I can paste the code. Thanks!

  • <script> jQuery(function($){ $("#no-reply-120730 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>