Last active
March 22, 2018 21:06
-
-
Save thecodepoetry/9ceced7f7dff0501c01c to your computer and use it in GitHub Desktop.
Dynamic page layout management
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'get_header', 'dt_archive_layout', 10 ); | |
function dt_archive_layout() { | |
$config = Presscore_Config::get_instance(); | |
if( is_archive() || is_category() || is_search() ){ | |
$config->set( 'template.columns.number', '5' ); | |
$config->set( 'post.preview.width.min', '200' ); | |
$config->set( 'image_layout', 'resize' ); | |
$config->set( 'thumb_proportions', array( "width" => "2", "height" => "1" ) ); | |
} | |
} |
This is very helpful. Thanks
Hi,
I search on wich file i can put
echo '<pre>'; print_r($config); echo '</pre>';
after
presscore_config_base_init();
Thx :)
Hi,
Can I create separate archive layout for teammate posts?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try this cod in your child theme functions.php to change layout of archive, category number of columns.
To get the exact same settings of you blog listing page, try to print the config vales in the original template you are using and apply to the dynamic page like shown above.
to print the values edit the template, after line
presscore_config_base_init();
add these (temporary, remove once you get the configs)
echo '<pre>';
print_r($config);
echo '</pre>';
PS: making these will print large amount Raw script on site and doing this directly on a live site is not suggested, If you are not comfortable with coding please get help of a developer.