-
AuthorPosts
-
January 16, 2015 at 3:38 pm #380782
Hello,
I made a custom post. I would like to add the Layout Setting on the sidebar in the admin panel, or make a default setting for this custopm post template.
Example, I would like to have set the header visibility to transparent.I see that most of the setting are in the $avia_config, and if i print it I see there is a header_setting array with the header_transparency. But I don’t know the value to give to it.
Which is the best way to do it?
thanks
January 16, 2015 at 3:51 pm #380793I see that if I modify the meta.php file inside the enfold folder and I add for the ‘page’=>array my custom post ( twice ), I have the layout in the sidebar. There is another method to set this inside the chiuld theme?
And also my second question is still valid ( how to set these value inside the custom post template ).thanks!
January 16, 2015 at 11:38 pm #381136Hey!
I’m not sure if it would be possible to do in a template but you can do it in a child theme. See here for more info, https://kriesi.at/support/topic/overriding-functions-in-a-child-theme/.
Cheers!
ElliottJanuary 18, 2015 at 8:36 am #381382Hello and thanks for answer.
I think I found a good way to do what I want ( and possible other people want also ).
What I would like to do is, ini my child theme, to create my custom post template using the Layout Builder, but only to create the template and not to give the user the right to use and change it. In this way, if I want to change the layout of all the custom post, I have only to change the template, and not change the setting for every single custom post.What i did is:
0) Activate the layout builder for your custom post ( https://vimeo.com/64996057 )
1) Make a page using the Layout Builder to generate the shortcode. This will be your template for the custom post.
2) Copy the shortcode it generates and save it somewhere ( you must have the avia debug ON to see them into the admin page, just put into your functions.php file this:add_action('avia_builder_mode', "builder_set_debug"); function builder_set_debug(){ return "debug"; }
3) Copy the template-builder.php in your child theme directory.
4) In this file, at the beginning of the file, get all your data of your custom post from $post:
– Your content
– Your custom fields
5) Now put it into a $content variable which must have all the shortcodes you copied before with your content and custom field inside. I suggest to use heredoc method:$content = <<<EOD [av_section color='main_color' …….. [av_video src=‘$my_video’ format='16-9' width='16' height='9'] [av_textblock size='' font_color='' ….. etc….. EOD;
Also better if you do step 4 and 5 in a function like get_your_custom_post_template( $post ); that return $content.
6) Now go to the line
$content = apply_filters('avia_builder_precompile', get_post_meta(get_the_ID(), '_aviaLayoutBuilderCleanData', true));
and make an if statement where you check if is displayed your custom postif ( $post->post_type == 'your-custom-post' ){ $content = get_your_custom_post_template( $post ); $content = apply_filters( 'avia_builder_precompile', $content ); } else { //filter the content for content builder elements $content = apply_filters('avia_builder_precompile', get_post_meta(get_the_ID(), '_aviaLayoutBuilderCleanData', true)); }
Everything is working, but there are something still to fix.
1) How to make default setting fot the Layout ( right sidebar admin panel. Example set the Page Layout, and the Header setting ). I see that these settings are registered in a custom fields, like:
_aviaLayoutBuilder_active
sidebar
header_transparency
etc….
But I don’t know where to hook to set these, if during the save or during the get of the page.
Moreover we can hide from the user the Layout on the sidebar with css.2) Avoid the user to activate the Advanced Layout Editor. Infact in case he doesn’t activate it, the template is going to use the single.php ( or single-your_custom_post.php in case ) template.
3) On the frontend I have a div with nothing inside that make a white space between the menu and the content. It is this one:
<div class=”main_color container_wrap fullsize”>…</div>
I think it is due to the fact that this is a post and not a page. Do you know how to avoid it?I thinks is all, and thanks do much for support
January 20, 2015 at 5:46 pm #382564Hey!
1. + 2. This is going to take a lot of time and code and would have to be considered custom work.
3. If your just trying to create some white space you could use a color section or the separator element. Send us a link to your page so we can get a better idea of your layout.
Regards,
ElliottJanuary 21, 2015 at 8:26 am #382894This reply has been marked as private.January 21, 2015 at 8:36 am #382895This reply has been marked as private.January 21, 2015 at 9:10 pm #383351Hi!
If there is white space above the color section then you most likely have something displayed above it in the avia layout builder.
What is this part for?
$content = <<<EOD
Send us a WordPress login and we’ll take a closer look.
Best regards,
ElliottJanuary 25, 2015 at 7:13 am #385058This reply has been marked as private.January 26, 2015 at 7:10 pm #385732Hi!
I’m sorry but I do not know. This customization is bordering on custom work anyway so it would be best to hire a freelancer to help you out.
Cheers!
Elliott -
AuthorPosts
- You must be logged in to reply to this topic.