This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//* Add featured image in RSS feed | |
add_filter('the_content_feed', 'qr_rss_featured'); | |
function qr_rss_featured($content) { | |
global $post; | |
if( has_post_thumbnail($post->ID) ) | |
$content = ' ' . get_the_post_thumbnail($post->ID, 'thumbnail') . ' ' . $content; | |
return $content; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="es-MX"> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Tituo de la pagina</title> | |
<meta name="description" content="Agregar descripcion"> | |
<style type="text/css"> <!--Fix width, height and margin --> | |
img { | |
width: 600px; | |
height: 340px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//* Modify header title-url depending on WP site language - HTML5 Version (Genesis Framework) | |
add_filter( 'genesis_seo_title', 'qr_header_title', 10, 3 ); | |
function qr_header_title( $title, $inside, $wrap ) { | |
// Default | |
$taitol = sprintf('<span class="custom-class">QR</span> %s', get_bloginfo( 'name' )); | |
$inside = sprintf( '<a href="https://qrokes.com/" title="%s">%s</a>', 'Inicio', $taitol ); | |
$currentlang = get_bloginfo('language'); | |
// English | |
if($currentlang=="en-US") { | |
$inside = sprintf( '<a href="https://qrokes.com/en/" title="%s">%s</a>', 'Home', $taitol ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Genesis Framework | |
* Multilingual archive sitemap template (page_archive.php) | |
**/ | |
//* Template Name: Archive | |
// Remove standard post content output | |
remove_action( 'genesis_post_content', 'genesis_do_post_content' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'pre_get_posts', 'qr_exclude_tagged_posts' ); | |
function qr_exclude_tagged_posts( $query ) { | |
if ( $query->is_main_query() && $query->is_home() ) { | |
$query->set( 'tag__not_in', array( 63 ) ); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$args = array( 'hide_empty=0' ); | |
$terms = get_terms( 'my-taxonomy', $args ); | |
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) { | |
$count = count( $terms ); | |
$i = 0; | |
$term_list = '<p class="term-list">Tags: '; | |
foreach ( $terms as $term ) { | |
$i++; | |
$term_list .= '<a href="' . esc_url( get_term_link( $term ) ) . '" alt="' . esc_attr( sprintf( __( 'View all post filed under - %s -', 'my_localization_domain' ), $term->name ) ) . '">' . $term->name . '</a>'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'genesis_before_sidebar_widget_area', 'qr_remove_default_sidebar' ); | |
function qr_remove_default_sidebar() { | |
if ( get_post_type() == 'my-cpt' ) { // set CPT here | |
remove_action( 'genesis_sidebar', 'ss_do_sidebar' ); | |
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' ); | |
add_action( 'genesis_sidebar', 'qr_add_cpt_sidebar' ); | |
} | |
} | |
function qr_add_cpt_sidebar() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$img_url = 'http://someurl.com/image.jpg'; | |
if ( !empty( $img_url ) ) { | |
$tmp_file = download_url( $img_url, 10 ); | |
if ( !is_wp_error( $tmp_file ) ) { | |
$size = getimagesize( $tmp_file ); | |
$img_width = $size[0]; | |
$img_height = $size[1]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Based on: https://wordpress.org/plugins/comment-reply-email-notification/ */ | |
add_action('wp_insert_comment', 'qr_comment_notification', 99, 2); | |
add_action('wp_set_comment_status','qr_comment_status_update', 99, 2); | |
add_filter('wp_mail_content_type', function($contentType) { return 'text/html'; }); | |
/** | |
* Sends an email notification when a comment receives a reply | |
* @param int $commentId The comment ID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Amazon SES (AWS) instead php mail. | |
add_action( 'phpmailer_init', 'qr_aws_ses_smtp' ); | |
function qr_aws_ses_smtp( $phpmailer ) { | |
$phpmailer->isSMTP(); | |
$phpmailer->Host = 'email-smtp.us-east-1.amazonaws.com'; | |
$phpmailer->SMTPAuth = true; | |
$phpmailer->Port = 25; | |
$phpmailer->Username = 'AWS SES Credentials - username'; | |
$phpmailer->Password = 'AWS SES Credentials - password'; | |
$phpmailer->SMTPSecure = 'tls'; |