File: /home/zeusxp5/zenoxpressjobs.com/wp-content/themes/zxldfw-tcompanyllcMain/functions/helpers.php
<?php
/**
* Various funcitons to help in the development of ACW themes.
*
* @package WebcomAcwTheme
*/
/**
* Function to get page content, to display within a page template.
*
* Usage:
* get_page_content('page-slug');
*
* @param string $page_name URL Slug of the page content.
*/
function get_page_content( $page_name = '' ) {
if ( ! $page_name ) {
return false;
}
global $post;
$post = get_post( get_page_by_path( $page_name ) );
setup_postdata( $post );
the_content();
wp_reset_postdata( $post );
}
/**
* Function to get page content, to display using a shortcode.
*
* Usage:
* [get_page_content page="page-slug"]
[get_sidebar name="webcom_sidebar_01" wrap="true"]
*
* @param string $page_name URL Slug of the page content.
*/
function sidebar_shortcode($atts, $content="null"){
extract(shortcode_atts(array('name' => '', 'wrap' => 'true', 'class' => ''), $atts));
$sidebar = '';
if(is_active_sidebar($name)) {
ob_start();
if($wrap == 'true') echo '<div class="'.$class.'">';
dynamic_sidebar($name);
if($wrap == 'true') echo '</div>';
$sidebar = ob_get_contents();
ob_end_clean();
}
return $sidebar;
}
add_shortcode('get_sidebar', 'sidebar_shortcode');
function check_section($section_name, $section_array) {
if (is_array($section_array) && in_array($section_name, $section_array, true)) {
return true;
}
return false;
}