Created
February 8, 2016 21:16
-
-
Save AndreaBarghigiani/f729dbad76694f05055a to your computer and use it in GitHub Desktop.
Single course view
This file contains hidden or 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
<?php | |
/** | |
* Genesis Framework. | |
* | |
* Questo file mi sara' utile per gestire il layout | |
* delle pagine contenenti i singoli corsi | |
* | |
* @package Genesis\Templates | |
* @author Codeat | |
* @license GPL-2.0+ | |
* @link http://codeat.it | |
*/ | |
//Forzo il layout come full width | |
add_filter('genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' ); | |
//Rimuovo post meta | |
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 ); | |
//Rimuovo le briciole di pane | |
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' ); | |
//*Sposto il titolo del corso dal contenitore | |
//remove_action( 'genesis_entry_header', 'genesis_do_post_title' ); | |
//add_action( 'genesis_before_entry', 'genesis_do_post_title' ); | |
if( !is_user_logged_in() ){ | |
add_action( 'genesis_before_comments', 'skam_display_banner' ); | |
} | |
//*Wrappo le varie Badge in un unico contenitore div.badges_wrap | |
add_filter( 'the_content', 'wrappo_badges' ); | |
function wrappo_badges( $cont ){ | |
if( has_shortcode( $cont, 'badgeos_achievement' ) ){ | |
$pattern = '/\[badgeos_achievement id=\"[0-9]+\"\]/'; | |
preg_match_all( $pattern, $cont, $matches, PREG_OFFSET_CAPTURE); | |
$first_match = $matches[0][0]; | |
$first_match_start = $first_match[1]; // Start position of the first match | |
$last_match = $matches[0][ count($matches[0]) - 1 ]; | |
$last_match_start = $last_match[1]; | |
$last_match_end = $last_match_start + strlen($last_match[0]); | |
$before_html = substr($cont, 0, $first_match_start); // Get all the content before the first match of [component id="XYZ"] | |
$component_shortcodes = substr($cont, $first_match_start, $last_match_end - $first_match_start ); // Get everything in between the first [component id="XYZ"] and the last | |
$after_html = substr($cont, $last_match_end ); // Get everything after the last [component id="XYZ"] match | |
// Perform the actual wrapping here | |
$new_content = $before_html . '<div class="badges_wrap">' . $component_shortcodes . '</div>' . $after_html; | |
$cont = $new_content; | |
} | |
return $cont; | |
} | |
//Rimuovo la Sidebar | |
//remove_action( 'genesis_sidebar', 'genesis_do_sidebar' ); | |
//Aggiungo i messaggi del forum | |
add_action( 'genesis_entry_footer', 'show_lastest_forum' ); | |
function show_lastest_forum(){ | |
if( function_exists( 'bbp_get_template_part' ) ){ | |
bbp_get_template_part( 'bbpress/content', 'archive-topic' ); | |
} | |
} | |
//* Remove the entry footer markup (requires HTML5 theme support) | |
remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 ); | |
remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 ); | |
remove_action( 'genesis_entry_footer', 'genesis_post_meta' ); | |
//Richiamo Genesis | |
genesis(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment