Site logo

Archived topic

Issues with hook

9 replies · Started by David on January 23, 2020

Viewing posts 1–10 of 10

Hello!

Issue 1: We have a "scientifically reviewed by xxx" added here: https://socialpronow.com/blog/how-to-bond/

It was added as through a hook. (after_entry_title)

However, we also want it to show up under the author name for the same articles in archives: https://socialpronow.com/blog/

Issue 2: If you make a mobile preview of the scientifically reviewed text, you see that it's smaller than the author text above it: https://socialpronow.com/blog/how-to-bond/

When looking at the author text in chrome inspector it says font-size 85%, so that's what I set the scientifically reviewed to, but it still behaves differently. How can we make it the same?

Issue 3: How do I change the link color on author to match the one of scientifically reviewed by?

Hi there,

1. Did you include Blog and All Archives under the display rules of the element?

2. On mobile it actually inherits the body text setting so try this:

@media (max-width: 768px) {
    .factchecked {
        font-size: inherit;
    }
}

3. Try Customizer > Colors > Content > Entry meta Links Hover.

Let me know if this helps :)

Hello, 2,3 solved - thank you!

For 1, when adding blog + all archives to the display rule, the "scientifically reviewed by" shows on all blog posts on archive. We only want them to show for those posts that have actually been reviewed. Ie, the blog posts that have been tagged with "reviewed by".

Hi there,

For your All Archives and Blog Hook you can add a condition around your HTML like so:

<?php if ( has_tag( 'tag_slug' ) ) { ?>
    // Display your HTML 
<?php } ?>

just change the tag_slug to match the requirement.

Hi, David

I tried adding the following as a hook and set display rules to blog and all archives.

<?php if ( has_tag( 'fact-checked-by-viktor-sander-b-sc-b-a' ) ) { ?>
<p class="factchecked">Scientifically reviewed by <a href="https://socialpronow.com/about-viktor-sander/">Viktor Sander B.Sc., B.A.</a></p>
<?php } ?>

However, it still shows the hook for articles without that tag.

Can you link us to a post with that tag?

Let me know :)

That post has a tag of:

reviewed-by-viktor-sander-b-sc-b-a

You shouldn't need any of the PHP inside the hook if you're using the Display Rules to target the tag. Can you try without?

This archived topic is closed to new replies.