-
AuthorPosts
-
October 11, 2014 at 11:28 pm #334410
Hello, I am trying to look for a way to insert code in between the title + breadcrumbs area and the page content.
I found a hook named: ava_after_main_container but this places the content after the header and before the title + breadcrumbs.
How can I do this? Is there a full list of available hooks I could play with?
Thanks!
October 13, 2014 at 9:12 am #334727Hi momon!
Thank you for using Enfold.
You can use this:
add_filter('avf_title_args', 'avf_title_args_append', 1); function avf_title_args_append($args) { $appendcontent = "<div class='container_wrap append-content'>"; $appendcontent .= "<div class='container'>"; $appendcontent .= "CONTENT HERE>"; $appendcontent .= "</div>"; $appendcontent .= "</div>"; $args['html'] = "<div class='{class} title_container'><div class='container'><{heading} class='main-title entry-title'>{title}</{heading}>{additions}</div></div>{$appendcontent}"; return $args; }
You can find some of the hooks and snippets on Theme Documentation.
Regards,
IsmaelOctober 13, 2014 at 4:37 pm #335009Thank you, I will try that. I did a search on http://kriesi.at/documentation/enfold/ and could not find any information that would point me towards the available hooks in the theme.
October 13, 2014 at 4:39 pm #335011FYI, just tested the code but it doesn’t seem to work on the homepage.
October 14, 2014 at 8:32 am #335425Hey!
It will only work if the title and breadcrumbs are activated. Not all hooks are documented. You can find some on the Code Snippet section.
Best regards,
IsmaelOctober 14, 2014 at 4:29 pm #335632Ok that makes sense and I can accept that limitation. In this case is there any hook that would allow me to do the same thing specifically on the homepage then? (or perhaps on a page that does not have the title / breadcrumbs setup?)
Thanks.
October 15, 2014 at 2:39 am #335860Hi!
You can use the ava_after_main_container hook coupled with is_home or is_frontpage conditional. :)
Regards,
IsmaelOctober 15, 2014 at 3:35 am #335885Humm, would you mind giving me the code? I am not entirely sure how to code that as suggested.
Thanks.
October 21, 2014 at 9:53 am #338922Hi!
Something like this:
add_filter('ava_after_main_container', 'ava_after_main_container_append', 1); function ava_after_main_container_append() { if(is_home()) { //SOME CODES HERE } }
Regards,
IsmaelOctober 21, 2014 at 4:35 pm #339067I tried this:
add_filter('ava_after_main_container', 'ava_after_main_container_append', 1); function ava_after_main_container_append() { if(is_home()) { echo 'some sample content'; } }
It did not work. There was no output on the homepage.
October 28, 2014 at 12:08 pm #342163Hey!
Replace the code with this:
add_filter('ava_after_main_container', 'ava_after_main_container_append', 1); function ava_after_main_container_append() { if(is_front_page()) { echo 'some sample content'; } }
Cheers!
IsmaelOctober 28, 2014 at 5:58 pm #342348Thank you, that does work.
-
AuthorPosts
- The topic ‘Adding content after title + breadcrumbs but before page content’ is closed to new replies.