[Resolved] Create Hook with Custom Display Rule

Home Forums Support Create Hook with Custom Display Rule

  • This topic has 3 replies, 2 voices, and was last updated 5 months ago by David.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #1474186
    Rizki Alief Irfany

    Hi team,

    Is it possible to create a hooks element with display rules only in articles written by certain people ? Because there are several authors on my blog.


    Customer Support

    Hi there,

    its tricky but is possible with some PHP – so better question is what exactly would be the difference between each of the authors hooks ? As it may be simpler to create a single hook that outputs that content dynamically.

    Rizki Alief Irfany

    Hi David,

    The difference is some promotion-related information. OK, how do I create dynamic content on single hook ?

    Or maybe you can explain “some php” you mean ? I think I can understand it enough if it’s not too complex / doesn’t require too much custom, hehe.

    Customer Support

    For Dynamic content you can use Advanced Custom Fields create a new User field so they are displayed in the user profile.

    To display that field in the hook would require a little PHP:

    // Get the post author ID
    $author_id = get_the_author_meta('ID');
    // Get the custom field
    $my_custom_field = get_field('custom_field_slug', 'user_'. $author_id );
    // Display field
    echo '<p class="custom-class">' . $my_custom_field . '</p>'; 

    This article goes into a lot of detail for creating User fields:


    For Display Rules to set different Hooks – Tom explains here:


Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.