Community Forums › Forums › Archived Forums › General Discussion › PHP echo is outputted in wrong order ?
- This topic has 6 replies, 2 voices, and was last updated 7 years, 2 months ago by Matus.
-
AuthorPosts
-
July 15, 2017 at 10:54 am #209146MatusMember
I have a custom written PHP snippet which removes default entry meta text above post and then output custom one.
This is my code:
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 ); add_action('genesis_entry_header', 'custom_entry_meta'); function custom_entry_meta() { if ( ! is_singular( 'post' ) & ! is_category('') & ! is_home() ) return; ?> <p class="entry-meta"> <?php echo "THIS SHOULD BE FIRST"; ?> <span class="entry-avatar"> <?php echo get_avatar(get_the_author_meta('email'), 30); ?> </span> <span class="entry-author"> <?php the_author_posts_link(); ?> </span> <span class="entry-time"> <?php echo $pfx_date = get_the_date( $format, $post_id ); ?> </span> <span class="entry-categories"> <?php the_category( ' ' ); ?> </span> </p> <?php }
I'd like to display the
echo
values in the exact same order as it is written above.The only
echo
script which isn't outputted at the right place is the first one (with the text "THIS SHOULD BE FIRST").How can I make that
echo
which shows text "THIS SHOULD BE FIRST" be outputted as first?July 15, 2017 at 11:09 am #209147Victor FontModeratorIt would help if you posted a link to a page that is using the script.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?July 15, 2017 at 11:38 am #209152MatusMemberThis reply has been marked as private.July 15, 2017 at 12:08 pm #209158Victor FontModeratorNobody can read private replies except forum moderators.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?July 15, 2017 at 12:24 pm #209159MatusMemberAh, I didn't know that 🙂
This is what I wrote you:
I created a new test user for you (my website is in maintenance mode).
Login page
Username: studiopress
Password: forum123TestAlso my website is in slovak language - WP admin is in english, so as instructions.
All you need to do after you login:
1. go to the homepage
2. Look at the first postI wrote you there some details ?
July 15, 2017 at 2:23 pm #209161Victor FontModeratorYour content is outputting exactly as written in your plugin. If you examine the generated source code with your browser's inspect tool, you can see that the code is correct. https://victorfont.com/how-to-use-your-browsers-inspect-tool/
The reason why the avatar is displaying in front of the first echo is because the avatar has a float:left in CSS. Float left pushes the avatar in front of everything else. All you need to do is fix the css.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?July 17, 2017 at 1:47 am #209200MatusMemberThanks.
Adding this CSS code fixed the problem:
.avatar { float:none; }
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.