- This topic has 16 replies, 3 voices, and was last updated 7 years, 4 months ago by
Tom.
-
AuthorPosts
-
November 19, 2018 at 2:16 am #730734
Edin
Hello,
I’ve successfully moved all the hooks, except this one that just doesn’t want to work:
Old Legacy Hook:

New Elements Hook:

Display Rules:

Any idea why it won’t work?
Thanks,
EddieNovember 19, 2018 at 5:12 am #730863David
StaffCustomer SupportHi there,
does it not render anything?
Also note that you have a shortcode within the PHP – what happens if you check the execute shortcode as wellNovember 20, 2018 at 7:16 am #732220Edin
I’ve just tested again with execute shortcode enabled, and it comes up empty again.
November 20, 2018 at 8:28 am #732315David
StaffCustomer SupportAny chance you can copy and paste the exact code you are using here?
November 20, 2018 at 8:40 am #732336Edin
Sure.
New Elements:
<div class="entry-meta">by <?php the_author(); ?>, <?php echo do_shortcode( '[est_time]' ); ?> read, <?php comments_number( 'no responses', 'one response', '% responses' ); ?>, updated on <span class="date updated published"><time datetime="<?php the_modified_time('Y-m-d'); ?>" itemprop="dateModified"><?php the_modified_time('M jS, Y'); ?></time></span></div>Old GP Hooks:
<?php if ( is_single() ) : ?><div class="entry-meta">by <?php the_author(); ?>, <?php echo do_shortcode( '[est_time]' ); ?> read, <?php comments_number( 'no responses', 'one response', '% responses' ); ?>, updated on <span class="date updated published"><time datetime="<?php the_modified_time('Y-m-d'); ?>" itemprop="dateModified"><?php the_modified_time('M jS, Y'); ?></time></span></div><?php endif; ?>November 20, 2018 at 8:58 am #732369David
StaffCustomer SupportDo you still have the Legacy Hook with that code in it? If so can you delete and make sure to empty the trash.
November 20, 2018 at 9:02 am #732379Edin
No, before testing it, I‘ve disabled and saved the legacy hook (that’s how I did it with the migration of all other hooks).
November 20, 2018 at 9:10 am #732389Tom
Lead DeveloperLead DeveloperWhat happens if you add a random word like “Test” after your new hook content? Does it appear on the page at all?
November 20, 2018 at 9:21 am #732421Edin
Yes, “Test” appears exactly where it should be when added at the end.
November 20, 2018 at 9:26 am #732425Edin
Ok, I experimented a little, when I remove:
<div class="entry-meta"></div>it works.
Where’s the problem?
November 20, 2018 at 9:46 am #732447Tom
Lead DeveloperLead DeveloperAh, the theme is probably set to remove the post meta, which adds CSS to hide that element.
Try adding this:
.entry-meta { display: block; }November 20, 2018 at 10:03 am #732466Edin
Perfect Tom, it worked (I had to add a !important though).
Thank you!
November 20, 2018 at 3:06 pm #732735Tom
Lead DeveloperLead DeveloperIf you want to avoid
!important, try this:.entry-content .entry-meta { display: block; }Glad I could help! 🙂
November 21, 2018 at 12:15 am #733006Edin
Thanks again, Tom.
Just a quick question, is it recommendable to avoid
!important? I’m using it all over the place…November 21, 2018 at 9:21 am #733574Tom
Lead DeveloperLead DeveloperIt’s best practice to avoid it where possible 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.