- This topic has 9 replies, 4 voices, and was last updated 3 years, 3 months ago by
Fernando.
-
AuthorPosts
-
July 18, 2022 at 2:51 am #2285887
Erika
Hi there,
is there a way to insert a hook (just like a subtitle) into the post template of the Query Loop block?
It should look like in the link, the element is created as a block element –> type:hook, inserted under the entry title. However, I´d like to have it in the Query Loop block unter the entry title.
Thanks, Erika
July 18, 2022 at 6:11 am #2286084David
StaffCustomer SupportHi there,
you can try creating a hook within a shortcode with this PHP Snippet:
function db_hook_inside_shortcode($atts, $content = null) { ob_start(); do_action('db_inside_post_loop'); return ob_get_clean(); } add_shortcode('hooky_shortcode', 'db_hook_inside_shortcode');This creates a shortcode called:
[hooky_shortcode]which you can add inside a Headline block.
That then creates a hook called:db_inside_post_loopI haven’t tested this…
July 18, 2022 at 8:02 am #2286349Erika
Sorry, I did not fully get it.
I created a snippet in Code snippet with the above code.
Then I go to a) Elements > the block-element I created –> insert short code? or b) I go to the Query Loop block and insert the short code there?
How does this function get the custom field content from the post?July 18, 2022 at 8:13 am #2286363David
StaffCustomer SupportHow does this function get the custom field content from the post?
How id this added ?
If its just a straight forward custom field, then you don’t need a hook or any of the above.
1. Add a Headline Block.
2. Enable its Dynamic Data options
3. Set these options
Data Source:Post
Content Source:Post Meta
Post meta field:enter the name of your custom fieldJuly 18, 2022 at 8:39 am #2286404Erika
I´ll go crazy. It was exactly what I was doing originally, but I forgot to press ENTER after entering the name of the custom field. So let´s keep it that simple.
July 19, 2022 at 3:52 am #2287135David
StaffCustomer SupportGlad to hear its working 🙂
March 6, 2023 at 4:32 pm #2558063Ron
Using the dynamic data works great.
Question: how do I turn the text link into an external link icon?March 6, 2023 at 6:27 pm #2558115Fernando Customer Support
Hi Ron,
You can add an icon and “remove the text”. Relevant article: https://docs.generateblocks.com/article/icon-overview/
March 6, 2023 at 8:08 pm #2558161Ron
I tried that and it hides the text in the editor, but not in the cpt archive page.
I did a workaround and used a button w/ icon and used Hide text. Same issue, so I used css to hide the button link text.March 6, 2023 at 8:38 pm #2558175Fernando Customer Support
I see. Glad you found a workaround.
If you’ll need further assistance regarding this, kindly open a new topic.
-
AuthorPosts
- You must be logged in to reply to this topic.