Blog Page Order

Thank you for your great help so far! I found a related posts plugin I like, configured and styled that along with a social sharing plugin, but here’s my quandry: I want to rearrange it so that it goes:

  1. Image
  2. Title
  3. Meta
  4. Tags
  5. Social
  6. Related Posts

Someone here gave me this to add to JS in theme options and it rearranges the image and title:

(function($){
$(’.single-post .entry-featured’).insertBefore( ‘.single-post .entry-header’ );
})(jQuery);

However, when you go to a post page, it briefly flashes on the original layout with the title above the image, then places it below where it should go according to the JS and I don’t love that.

Here’s a sample post:

https://www.advancedbiology.com/test-post-4/

What is the best practice - should I use JS to rearrange all of it, if so what are the parameters? If I should move copies of files from framework/views to my child theme, give me a hint as to which ones I should use, and if I can see the calls for each part in one of those I could rearrange it.

I want to rearrange the blog page as well, moving the title and meta below the image, and somehow creating a read more button rather than the text after the excerpt - I suppose I should do it the same way you instruct me to do the above?

Thank you so much guys, I’ve almost got it ready to go!

Update: I deleted the JS workaround, copied the content.php and _content-post-footer.php to framework/views/renew, removed the title and meta from the header and put it in the content area. I got everything styled the way I want it, including the tags, social sharing and related posts, but HOW do I get the bottom sequence to be:

Tags
social sharing
related posts

I can’t see where plugins like the social and related posts just decide to put themselves in whatever order. If I could get them in that order I would be set.

Also, somehow doing these adjustments I broke the blog page, I think I made a CSS error:

https://www.advancedbiology.com/lab/

Hi,

Best practice would be to copy files from your parent theme to your child theme and edit as you like.

eg.
Copy wp-content/themes/pro/framework/views/renew/content.php
to wp-content/themes/pro-child/framework/views/renew/content.php

You can then modify as you like the file that is in your child theme.

Please refer to the link below for more information.

Kindly note this particular customization request is outside the scope of our support as this is not related to an issue with the theme and instead has to do with your customization of it. As such, you will need to investigate this particular issue on your own or seek help from a developer should you not feel comfortable making these changes yourself.

Thank you for your understanding.

Thank you! I got it all working exactly how I wanted, but I have one final issue I’m hoping you can help me with - I want to move the tags up above the social sharing area - it’s a pain that if you add plugins for things that show up in the bottom of a post the theme always pushes the tags to the bottom. I know there is some code I can add to the functions file to change the content filter priority for the tags but I’m not sure how that piece of code looks - do you happen to know what it is? I’ve seen all kinds of cool things to add to the functions file here, just not that one.

https://www.advancedbiology.com/test-post-2/

Hello There,

Thank you for the clarifications.

Please be aware that most of the plugins will inject the plugin output using the the_content filter. You tags on the other hand is being displayed outside of the the_content() function. If you want your tags to be prioritize and added through the fillter, you may use this code in your child theme’s functions.php

add_my_tags(){ ?>
   <!-- // display my tags -->
  <p>These are all my tags</p>
<?php }
add_filter('the_content', 'add_my_tags', 5);

You may reduce the number 5 to a smaller number to make sure that it will be the first to display right after your post contents.

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

Thank you for the info. However, when I add that code to the functions.php in my child theme the site then gives me a 500 error and won’t load. If I remove it, it’s back to normal. I’ve added other code chunks to the functions file before without issue, am I doing something wrong, or do I need to modify it in some way?

Hello There,

Sorry if it does not work. There was an typographical error in the given code. I have made some modifications and use this instead:

// Add my tags
// =============================================================================
function add_my_tags($content){
  
  $content .= '<p>These are all my tags</p>';
  return $content;
}
add_filter('the_content', 'add_my_tags', 5);
// =============================================================================

For more details about filters, please check this out: https://developer.wordpress.org/reference/functions/add_filter/

Hope this helps.

Thank you - getting close, when I installed your code I got “These are all my tags” in the right position, but no tags, and the original loop tags are still below rather than being moved, see the screenshot.

Hello There,

Please bear in mind that I am only giving you an example code to get you started with your customization. You may need to modify the given code and integrate the code you have used in displaying your tags at moment. If you can give me the contents of your content-footer.php or the code that displays the tag, I might be able to help you in combining the codes.

Thank you for your understanding.

Gotcha. I noticed it appears on pages too, instead of just posts where I want it. Here’s what I have in my contents file where the tags come from, you will see it is placed twice, one if it is the blog page, and once when it is an individual post page. The post page is the only place I need to adjust the position of the tags.

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="entry-wrap">
<?php x_get_view( 'renew', '_content', 'post-header' ); ?>
<?php if ( has_post_thumbnail() ) : ?>
<div class="entry-featured">
<?php x_featured_image(); ?>
</div>
<?php if ( is_single() ) : ?>
<div class="post-title-meta">
<h1 class="entry-title"><?php the_title(); ?></h1>
<?php x_renew_entry_meta(); ?>    
<?php else : ?>
<h2 class="entry-title2">
<a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ); ?>"><?php the_title(); ?></a>
</h2>  
<div class="p-meta2"><?php x_renew_entry_meta(); ?></div>  
<?php endif; ?>
</div>
<?php endif; ?>   
<?php x_get_view( 'global', '_content' ); ?> 
<?php if ( has_tag() ) : ?>
<?php echo get_the_tag_list( '<p class="p-tags2">'. __( 'Tags: ', '__x__'), ', ', '</p>' ); ?>
<?php endif; ?>
</article>

Hello There,

To resolve your issue, you must remove this code block first:

<?php if ( has_tag() ) : ?>
<?php echo get_the_tag_list( '<p class="p-tags2">'. __( 'Tags: ', '__x__'), ', ', '</p>' ); ?>
<?php endif; ?>

And then, you can add this code in your child theme’s functions.php file:

// Add my tags
// =============================================================================
function add_my_tags($content){
  if ( has_tag() && is_single() ) :
  	$content .= get_the_tag_list( '<p class="p-tags2">'. __( 'Tags: ', '__x__'), ', ', '</p>' ); ?>
  endif;

  return $content;
}
add_filter('the_content', 'add_my_tags', 5);
// =============================================================================

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

I followed your instructions, removed that from the content page, added the other to the functions, and it created a 500. I tried adding the stuff back to content and still a 500, so it’s something about that code when it is placed in functions. It looks right, there must be some little tweak that needs to be done to that bit of code that goes in functions?

Hello There,

Sorry there was an invalid character in the code.
This is the correct code:

// Add my tags
// =============================================================================
function add_my_tags($content){
  if ( has_tag() && is_single() ) :
  	$content .= get_the_tag_list( '<p class="p-tags2">'. __( 'Tags: ', '__x__'), ', ', '</p>' );
  endif;

  return $content;
}
add_filter('the_content', 'add_my_tags', 5);
// =============================================================================

Please let us know if this works out for you.

AWESOME!!! Works perfectly! You guys are the best!!! Take a look:

https://www.advancedbiology.com/test-post-2/

Hey There,

You’re welcome! We are just glad we were able to help you out.
We really appreciate for letting us know that it has worked out for you.

Cheers.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.