| Server IP : 14.225.204.176 / Your IP : 216.73.216.6 Web Server : nginx/1.24.0 System : Linux nodejs-ybgk 6.8.0-40-generic #40-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 5 10:34:03 UTC 2024 x86_64 User : root ( 0) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/html/php/fe2tech/wp-content/themes/contio/inc/ |
Upload File : |
<?php
/**
* Functions which enhance the theme by hooking into WordPress
*
* @package Contio
*/
/*
* Get page ID by Slug
*/
function contio_get_id_by_slug($slug, $post_type){
$content = get_page_by_path($slug, OBJECT, $post_type);
$id = $content->ID;
return $id;
}
/**
* Get content by slug
**/
function contio_get_content_by_slug($slug, $post_type){
$content = get_posts(
array(
'name' => $slug,
'post_type' => $post_type
)
);
if(!empty($content))
return $content[0]->post_content;
else
return;
}
/**
* Show content by slug
**/
if(!function_exists('contio_content_by_slug')){
function contio_content_by_slug($slug, $post_type){
$content = contio_get_content_by_slug($slug, $post_type);
$id = contio_get_id_by_slug($slug, $post_type);
echo apply_filters('the_content', $content);
}
}
/**
* Adds custom classes to the array of body classes.
*
* @param array $classes Classes for the body element.
* @return array
*/
function contio_body_classes( $classes )
{
// Adds a class of group-blog to blogs with more than 1 published author.
if (is_multi_author()) {
$classes[] = 'group-blog';
}
// Adds a class of hfeed to non-singular pages.
if (!is_singular()) {
$classes[] = 'hfeed';
}
if (contio_get_opt( 'site_boxed', false )) {
$classes[] = 'site-boxed';
}
if ( class_exists('WPBakeryVisualComposerAbstract') ) {
$classes[] = 'visual-composer';
}
if (class_exists('ReduxFramework')) {
$classes[] = 'redux-page';
}
$body_default_font = contio_get_opt( 'body_default_font', 'Poppins' );
$heading_default_font = contio_get_opt( 'heading_default_font', 'Poppins' );
if($body_default_font == 'Poppins') {
$classes[] = 'body-default-font';
}
if($heading_default_font == 'Poppins') {
$classes[] = 'heading-default-font';
}
if (contio_get_opt( 'sticky_on', false )) {
$classes[] = 'header-sticky';
}
return $classes;
}
add_filter( 'body_class', 'contio_body_classes' );
/**
* Add a pingback url auto-discovery header for singularly identifiable articles.
*/
function contio_pingback_header()
{
if ( is_singular() && pings_open() )
{
echo '<link rel="pingback" href="', esc_url( get_bloginfo( 'pingback_url' ) ), '">';
}
}
add_action( 'wp_head', 'contio_pingback_header' );