hi. I have a CPT named lawyer. I have copied single.php and made single-lawyer.php in enfold-child. I dont want sidebar in this. I have made only 1 change in single-lawyer.php –
// get_template_part( 'includes/loop', 'index' );
the_content();
deleting this code from single-lawyer.php does not help me –
<?php
$avia_config['currently_viewing'] = "blog";
//get the sidebar
get_sidebar();
?>
I cant do so from theme options “Choose the blog post sidebar position here. This setting will be applied to single blog posts”
Because it removes sidebar from blog entry also.
Please suggest a solution or code in funcations.php
Hey simran1982,
Please make the code as following
<?php
$avia_config['currently_viewing'] = "blog";
//get the sidebar
//get_sidebar();
?>
And let us know if that worked out.
Best regards,
Basilis
Better solution without changing the template:
if(!function_exists('avia_layout_class')) {
function avia_layout_class($key, $echo = true) {
global $avia_config;
if(!isset($avia_config['layout']['current']['main'])) { avia_set_layout_array(); }
$return = apply_filters('avia_layout_class',$avia_config['layout']['current'][$key]);
if( $echo == true ) { echo $return; }
else { return $return; }
}
}
add_filter('avia_layout_class', 'cpt_change_sidebar');
function cpt_change_sidebar($class) {
if (get_post_type() == 'referenzen') { $class = str_replace("av-content-small","",$class); } // this removes the sidebar from CPT defined
return $class;
}
Unfortunatly the function has no filter, so I add one and replace the msall function, then add the hook to change the layout.