File: /home/c1190199/public_html/wp-content/wptouch-data/themes/classic-redux/default/functions.php
<?php
add_action( 'wp_enqueue_scripts', 'classic_enqueue_scripts' );
add_filter( 'amp_should_show_featured_image_in_header', 'classic_should_show_thumbnail' );
function classic_enqueue_scripts() {
wp_enqueue_script(
'classic-js',
CLASSIC_URL . '/default/classic.min.js',
array( 'jquery' ),
CLASSIC_THEME_VERSION,
true
);
}
function classic_should_show_thumbnail() {
$settings = classic_get_settings();
switch( $settings->use_thumbnails ) {
case 'none':
return false;
case 'index':
return is_home();
case 'index_single':
return is_home() || is_single();
case 'all':
return is_home() || is_single() || is_page() || is_archive() || is_search();
default:
// in case we add one at some point
return false;
}
}
function classic_should_show_taxonomy() {
$classic_settings = classic_get_settings();
if ( $classic_settings->show_taxonomy ) {
return true;
} else {
return false;
}
}
function classic_should_show_author() {
$classic_settings = classic_get_settings();
if ( $classic_settings->show_author ) {
return true;
} else {
return false;
}
}
function classic_should_show_date() {
$classic_settings = classic_get_settings();
if ( $classic_settings->show_date ) {
return true;
} else {
return false;
}
}
function classic_show_menu_button_text() {
$classic_settings = classic_get_settings();
if ( $classic_settings->menu_button_as_text ) {
return true;
} else {
return false;
}
}
function classic_show_page_titles() {
$classic_settings = classic_get_settings();
if ( $classic_settings->show_page_titles ) {
return true;
} else {
return false;
}
}
// Get URL of first image in a post
function catch_that_image() {
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
$first_img = $matches[1][0];
if(empty($first_img)) {
$first_img = "https://mysteryplanet.com.ar/blank.jpg";
}
return $first_img;
}
function get_fbimage() {
$src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), '', '' );
if ( has_post_thumbnail($post->ID) ) {
$fbimage = $src[0];
} else {
global $post, $posts;
$fbimage = '';
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i',
$post->post_content, $matches);
$fbimage = $matches [1] [0];
}
if(empty($fbimage)) {
$fbimage = "https://mysteryplanet.com.ar/mplogo-fb.jpg";
}
return $fbimage;
}
// CROP N' RISIZE:
if ( function_exists( 'add_image_size' ) ) add_theme_support( 'post-thumbnails' );
if ( function_exists( 'add_image_size' ) ) {
add_image_size( 'index-thumb', 120, 120, true );
add_image_size( 'related-thumb', 120, 120, true );
}