Order of custom fields on single post and archive pages

Hi,

I’ve added a some custom fields to the _content.php file, and everything is working fine, except that on the archive pages (for the category), the fields are appearing in the correct order, while on the single post page, the fields are appearing in the wrong order. For example, please take a look at this single post and category page:

https://staging4.upstatefilms.org/harriet
https://staging4.upstatefilms.org/category/now-showing-woodstock

On the category page, the custom field for the showtimes table appears above the custom field buttons for View Trailer and Review, which is just how I want it. (This is the order of the fields on the _content.php file.) But on the single post page, the buttons appear above the table. I can’t figure out why the fields are reversed on the single post page. Can you help me figure out how to put the buttons below the table on the single post page?

(By the way, this is a follow-up to https://theme.co/apex/forum/t/display-custom-field-on-post-index-pages/66065/2), where you showed me how to modify the _content.php file so that the custom fields would appear on index pages.)

Thanks for your help.

Also, you advised me to add this code, which may be affecting what I’m trying to do:

jQuery(".showtimes-moviepage")
.prependTo(".single-post .entry-content");

Hello Steve,

Thanks for writing in!

Please switch the JS code from:

jQuery(".showtimes-moviepage").prependTo(".single-post .entry-content");

To:

jQuery(".showtimes-moviepage").appendTo(".single-post .entry-content");

Hope this helps.

Thanks for the reply. Unfortunately, that did not work because it put the showtimes-moviepage field at the bottom of the post, below the main content. The order I’m looking for is the way the fields appear on the category page (https://staging4.upstatefilms.org/category/now-showing-woodstock).

Title
custom field for showtimes-moviepage table
custom fields for View Trailer and Review
main post content

Thanks again for your help.

Hi Steve,

I checked the code and it’s in correct order without this code

jQuery(".showtimes-moviepage").prependTo(".single-post .entry-content");

Title
custom field for showtimes-moviepage table
custom fields for View Trailer and Review
main post content

So you don’t need any fixes, would you mind providing what you’re seeing before the code is added? I can’t remove it through the browser since it’s javascript :slight_smile:

Thanks!

Yes, you are right. Without the javascript, the order is correct on both the single post and index pages. Your support team had previously recommended the js because the showtimes table was appearing at the end of the post, below the content. I’m not sure why it’s working without the js, but it is. So thank you very much once again for your fantastic support. I an converting this website to X largely because of your great support team.

Glad to hear that and you’re most welcome! Cheers :wink:

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