Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1248732
    sandra.i
    Participant

    That’s all brilliant now than you.

    Just one last thing on that blog page

    – how do change the colour of the ‘continue reading’ link?

    #1248862
    sandra.i
    Participant
    This reply has been marked as private.
    #1249196
    Friech
    Moderator

    Hi There,

    To change the color of “continue reading” link, add this on your custom CSS.

    .entry-content a {
    	color: red;
    }

    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. X is quite extensible with child themes, so there are plenty of possibilities.

    Thanks for understanding.

    #1249739
    sandra.i
    Participant

    Thanks for the code.

    I saw here https://community.theme.co/forums/topic/move-and-remove-some-of-the-meta-data/ that someone was helped with moving the categories list down to below the post. Do you think you might be able to help me adapt it?

    I just need the comments in the blog index page to move under ‘ Continue reading’

    You can see the blog here

    http://www.rochesterclinic.co.uk/news

    Thank you 🙂

    #1249862
    Paul R
    Moderator

    Hi,

    Upon checking, I don’t see any comments in your blog index page.

    To add a comment link at the end, you can try adding this in your child theme’s functions.php file.

    
    function my_categories() {   
        if(is_home()){
      if ( comments_open() ) {
    
          $title  = apply_filters( 'x_entry_meta_comments_title', get_the_title() );
          $link   = apply_filters( 'x_entry_meta_comments_link', get_comments_link() );
          $number = apply_filters( 'x_entry_meta_comments_number', get_comments_number() );
    
          
          $text = ( 0 === $number ) ? 'Leave a Comment' : sprintf( _n( '%s Comment', '%s Comments', $number, '__x__' ), $number );
    
          $comments = sprintf( '<span><a href="%1$s" title="%2$s" class="meta-comments">%3$s</a></span>',
            esc_url( $link ),
            esc_attr( sprintf( __( 'Leave a comment on: &ldquo;%s&rdquo;', '__x__' ), $title ) ),
            $text
          );
    
        } else {
    
          $comments = '';
    
        }
         printf( '<div class="my-comments">%s</div>',$comments);
        }}
    
    add_action( 'x_after_the_excerpt_end', 'my_categories' );
    

    Hope that helps.

    #1249966
    sandra.i
    Participant

    SO SORRY

    I meant the categories should move to the end of the post!

    #1250046
    Paul R
    Moderator

    Hi,

    In that case, please change the code to this.

    
    <?php
    function x_renew_entry_meta() {
    
        //
        // Author.
        //
    
        $author = sprintf( '<span>%s</span>',
          get_the_author()
        );
    
        //
        // Date.
        //
    
        $date = sprintf( '<span><time class="entry-date" datetime="%1$s">%2$s</time></span>',
          esc_attr( get_the_date( 'c' ) ),
          esc_html( get_the_date() )
        );
    
        //
        // Categories.
        //
    
        if ( get_post_type() == 'x-portfolio' ) {
          if ( has_term( '', 'portfolio-category', NULL ) ) {
            $categories        = get_the_terms( get_the_ID(), 'portfolio-category' );
            $separator         = ', ';
            $categories_output = '';
            foreach ( $categories as $category ) {
              $categories_output .= '<a href="'
                                  . get_term_link( $category->slug, 'portfolio-category' )
                                  . '" title="'
                                  . esc_attr( sprintf( __( "View all posts in: &ldquo;%s&rdquo;", '__x__' ), $category->name ) )
                                  . '"> '
                                  . $category->name
                                  . '</a>'
                                  . $separator;
            }
    
            $categories_list = sprintf( '<span>%s</span>',
              trim( $categories_output, $separator )
            );
          } else {
            $categories_list = '';
          }
        } else {
          $categories        = get_the_category();
          $separator         = ', ';
          $categories_output = '';
          foreach ( $categories as $category ) {
            $categories_output .= '<a href="'
                                . get_category_link( $category->term_id )
                                . '" title="'
                                . esc_attr( sprintf( __( "View all posts in: &ldquo;%s&rdquo;", '__x__' ), $category->name ) )
                                . '">'
                                . $category->name
                                . '</a>'
                                . $separator;
          }
    
          $categories_list = sprintf( '<span>%s</span>',
            trim( $categories_output, $separator )
          );
        }
    
        //
        // Comments link.
        //
    
        if ( comments_open() ) {
    
          $title  = apply_filters( 'x_entry_meta_comments_title', get_the_title() );
          $link   = apply_filters( 'x_entry_meta_comments_link', get_comments_link() );
          $number = apply_filters( 'x_entry_meta_comments_number', get_comments_number() );
    
          
          $text = ( 0 === $number ) ? 'Leave a Comment' : sprintf( _n( '%s Comment', '%s Comments', $number, '__x__' ), $number );
    
          $comments = sprintf( '<span><a href="%1$s" title="%2$s" class="meta-comments">%3$s</a></span>',
            esc_url( $link ),
            esc_attr( sprintf( __( 'Leave a comment on: &ldquo;%s&rdquo;', '__x__' ), $title ) ),
            $text
          );
    
        } else {
    
          $comments = '';
    
        }
    
        //
        // Output.
        //
    
        if ( x_does_not_need_entry_meta() ) {
          return;
        } else {
            if(!is_home()) {
          printf( '<p class="p-meta">%1$s%2$s%3$s%4$s</p>',
            $author,
            $date,
            $categories_list,
            $comments
          );
            }else{
                  printf( '<p class="p-meta">%1$s%2$s%3$s</p>',
            $author,
            $date,        
            $comments
          );
            }
        }
    
      }
    
    function my_categories() {   
        if(is_home()){
     //
        // Categories.
        //
    
        if ( get_post_type() == 'x-portfolio' ) {
          if ( has_term( '', 'portfolio-category', NULL ) ) {
            $categories        = get_the_terms( get_the_ID(), 'portfolio-category' );
            $separator         = ', ';
            $categories_output = '';
            foreach ( $categories as $category ) {
              $categories_output .= '<a href="'
                                  . get_term_link( $category->slug, 'portfolio-category' )
                                  . '" title="'
                                  . esc_attr( sprintf( __( "View all posts in: &ldquo;%s&rdquo;", '__x__' ), $category->name ) )
                                  . '"> '
                                  . $category->name
                                  . '</a>'
                                  . $separator;
            }
    
            $categories_list = sprintf( '<span>%s</span>',
              trim( $categories_output, $separator )
            );
          } else {
            $categories_list = '';
          }
        } else {
          $categories        = get_the_category();
          $separator         = ', ';
          $categories_output = '';
          foreach ( $categories as $category ) {
            $categories_output .= '<a href="'
                                . get_category_link( $category->term_id )
                                . '" title="'
                                . esc_attr( sprintf( __( "View all posts in: &ldquo;%s&rdquo;", '__x__' ), $category->name ) )
                                . '">'
                                . $category->name
                                . '</a>'
                                . $separator;
          }
    
          $categories_list = sprintf( '<span>%s</span>',
            trim( $categories_output, $separator )
          );
        }
    
         printf( '<div class="my-categories">%s</div>',$categories_list);
        }}
    
    add_action( 'x_after_the_excerpt_end', 'my_categories' );
    
     
    

    Hope that helps.

    #1250093
    sandra.i
    Participant

    Hi

    That’s showing the comments on the top of the posts in the blog index page, and not showing the categories at all.

    I was looking to have the categories at the bottom of the posts in the blog page, and no comments showing!

    #1250776
    Rue Nel
    Moderator

    Hello There,

    Thank you for the clarifications! To add a category at the bottom of the blog post, since you have your child theme active and ready, please follow the following steps below:
    1] Using Notepad or TextEdit or Sublime Text or any text editor, please create a new file in your local machine.
    2] Insert the following code into that new file

    <?php
    
    // =============================================================================
    // VIEWS/RENEW/_CONTENT-POST-FOOTER.PHP
    // -----------------------------------------------------------------------------
    // Standard <footer> output for various posts.
    // =============================================================================
    
    ?>
    
    <?php if ( has_tag() || has_category() ) : ?>
      <footer class="entry-footer cf">
      	<?php if ( has_category() ) : ?>
      		<?php echo get_the_tag_list( '<p><i class="x-icon-bookmark" data-x-icon=""></i>'. __( 'Category:', '__x__'), ', ', '</p>' ); ?>
      	<?php endif; ?>
    
      	<?php if ( has_tag() ) : ?>
        	<?php echo get_the_tag_list( '<p><i class="x-icon-tags" data-x-icon=""></i>'. __( 'Tags:', '__x__'), ', ', '</p>' ); ?>
        <?php endif; ?>
    
      </footer>
    <?php endif; ?>

    Please copy the raw code from here (http://pastebin.com/eBMnLeM0) to preserve the unicode html entity or the data-x-icon value.

    3] Save the file named as _content-post-footer.php
    4] Upload this file to your server in the child theme’s folder
    wp-content/themes/x-child/framework/views/renew

    Please let us know if this works out for you.

    #1251234
    sandra.i
    Participant

    Hi

    I think that’s broken the blog page.

    On the single post page I get this error:

    Parse error: syntax error, unexpected ‘\’ (T_NS_SEPARATOR), expecting identifier (T_STRING) in /home/linweb36/r/rochesterclinic.co.uk/user/htdocs/wp-content/themes/x-child/framework/views/renew/_content-post-footer.php on line 8

    #1251255
    Rue Nel
    Moderator

    Hello There,

    Sorry if it didn’t work out. There might be a typo error with the code. Please try to use this code instead:

    <?php
    
    // =============================================================================
    // VIEWS/RENEW/_CONTENT-POST-FOOTER.PHP
    // -----------------------------------------------------------------------------
    // Standard <footer> output for various posts.
    // =============================================================================
    
    ?>
    
    <?php if ( has_tag() || has_category() ) : ?>
      <footer class="entry-footer cf">
      	<?php if ( has_category() ) : ?> 
      		<?php 
    
    	  		//
    		    // Categories.
    		    //
    
    		    if ( get_post_type() == 'x-portfolio' ) {
    		      if ( has_term( '', 'portfolio-category', NULL ) ) {
    		        $categories        = get_the_terms( get_the_ID(), 'portfolio-category' );
    		        $separator         = ', ';
    		        $categories_output = '';
    		        foreach ( $categories as $category ) {
    		          $categories_output .= '<a href="'
    		                              . get_term_link( $category->slug, 'portfolio-category' )
    		                              . '" title="'
    		                              . esc_attr( sprintf( __( "View all posts in: &ldquo;%s&rdquo;", '__x__' ), $category->name ) )
    		                              . '"> '
    		                              . $category->name
    		                              . '</a>'
    		                              . $separator;
    		        }
    
    		        $categories_list = sprintf( '<span>%s</span>',
    		          trim( $categories_output, $separator )
    		        );
    		      } else {
    		        $categories_list = '';
    		      }
    		    } else {
    		      $categories        = get_the_category();
    		      $separator         = ', ';
    		      $categories_output = '';
    		      foreach ( $categories as $category ) {
    		        $categories_output .= '<a href="'
    		                            . get_category_link( $category->term_id )
    		                            . '" title="'
    		                            . esc_attr( sprintf( __( "View all posts in: &ldquo;%s&rdquo;", '__x__' ), $category->name ) )
    		                            . '">'
    		                            . $category->name
    		                            . '</a>'
    		                            . $separator;
    		      }
    
    		      $categories_list = sprintf( '<span>%s</span>',
    		        trim( $categories_output, $separator )
    		      );
    		    }
    
      		?>
      		<p><i class="x-icon-bookmark" data-x-icon=""></i> Category: <?php echo $categories_output; ?> </p>
    
      	<?php endif; ?>
    
      	<?php if ( has_tag() ) : ?>
        	<?php echo get_the_tag_list( '<p><i class="x-icon-tags" data-x-icon=""></i> '. __( 'Tags:', '__x__'), ', ', '</p>' ); ?>
        <?php endif; ?>
    
      </footer>
    <?php endif; ?>

    Again, please copy the raw code here (http://pastebin.com/9LvAsqzP) to preserve the unicode html entity or the data-x-icon value.

    We would loved to know if this has work for you. Thank you.

    #1251271
    sandra.i
    Participant

    Hi

    I’m still getting this error:

    Parse error: syntax error, unexpected ‘\’ (T_NS_SEPARATOR), expecting identifier (T_STRING) in /home/linweb36/r/rochesterclinic.co.uk/user/htdocs/wp-content/themes/x-child/framework/views/renew/_content-post-footer.php on line 8

    #1251301
    Lely
    Moderator

    Hello Sandra,

    Would you mind giving us FTP credentials on a private reply so we can check directly where is the error coming from? I can’t see it from the suggested code.

    #1251303
    sandra.i
    Participant
    This reply has been marked as private.
    #1251386
    Paul R
    Moderator

    Hi,

    Thank you for providing your ftp login.

    Upon checking, I can see your code have lots of unnecessary characters and syntax errors.

    http://screencast.com/t/wZrE28y5L

    I went ahead and fix it.

    Please use Sublime Text 2 or notepad++ in editing codes.

    Thanks

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