// ========================================================================= // REMOVE YOU ARE HERE FROM BREADCRUMB // ========================================================================= add_filter( 'genesis_breadcrumb_args', 'afn_breadcrumb_args' ); function afn_breadcrumb_args( $args ) { $args['labels']['prefix'] = ''; return $args; }
Genesis
Genesis translations
<?php // ========================================================================= // GENESIS TRANSLATIONS WITHOUT LOCO TRANSLATE // ========================================================================= function genesis_hungarian_translations( $translated, $original, $domain ) { if ( $translated == "Leave a Comment" ) { $translated = "Hozzászólás írása"; } if ( $translated == "by" ) { $translated = "Szerző: "; } if ( $translated == "Filed Under: " ) { $translated = "Kategória: "; } if ( $translated == "Tagged With: " ) { $translated = "Címkék: "; } return $translated; } add_filter( 'gettext', 'genesis_hungarian_translations', 10, 3 );
Add page title with featured image as background in Genesis
Step #1 Create a file with name “page-title.php”
You can set a static background image in the else statement, just replace the dotted line with your uploaded image URL:
Step #2 Add this snippet to functions.php
Step #3 Add this to your CSS
Genesis Loop with Pagination
Full-width hero image on category / tag / taxonomy archive pages in Genesis
Below is a variation of the earlier linked tutorial which will work not only on category archives (Ex.: example.com/category/category-1) but also on tag archives (Ex.: example.com/tag/headlines) and any other custom taxonomy term archive pages (Ex.: example.com/portfolio_category/featured).
Step 1
Install and activate WP Term Images plugin.
Step 2
Edit category / tag / taxonomy archive pages and set your desired images.
Step 3
Add the following in child theme’s functions.php:
// Register custom image size for hero images on category / tag / taxonomy archive pages. add_image_size( 'category-image', 1600, 400, true ); add_action( 'genesis_after_header', 'sk_taxonomy_term_hero_image' ); /** * Display hero image below header on category / tag / taxonomy archive pages. */ function sk_taxonomy_term_hero_image() { global $wp_query; // if we are not on a category archive or tag archive or a taxonomy archive, abort. if ( ! is_category() && ! is_tag() && ! is_tax() ) { return; } // get and store the object of current taxonomy term or category or tag. $term = is_tax() ? get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ) : $wp_query->get_queried_object(); if ( ! $term ) { return; } // image id is stored as term meta. $image_id = get_term_meta( $term->term_id, 'image', true ); // image data stored in array, second argument is which image size to retrieve. $image_data = wp_get_attachment_image_src( $image_id, 'category-image' ); // image url is the first item in the array (aka 0). $image = $image_data[0]; // if there's no image for this category, abort. if ( empty( $image ) ) { return; } printf( '<figure class="term-image"><img src="%s" alt="%s" /></figure>', $image, single_cat_title( '', false ) ); }
Step 4
Add the following in child theme’s style.css:
.category-image img { vertical-align: top; width: 100%; }
References:
How to display taxonomy term image below archive intro text in Genesis
Remove Entry Meta from Genesis Single Post
//Remove Entry Meta from Genesis Single Post add_action( 'loop_start', 'remove_entry_meta' ); function remove_entry_meta() { if ( is_singular('post') ) { remove_action( 'genesis_entry_header', 'genesis_post_info', 12 ); remove_action( 'genesis_entry_footer', 'genesis_post_meta' ); } }
How to create 4 col Bootstrap Carousel from Custom Post Type in Genesis
<!-- Carousel --> <div id="promo-carousel" class="carousel job-carousel-wrapper slide" data-ride="carousel" data-interval="3000"> <!-- Wrapper for slides --> <div class="carousel-inner" role="listbox"> <?php // Item size (set here the number of posts for each group) $i = 4; // Set the arguments for the query global $post; $args = array( 'numberposts' => 16, // -1 is for all 'post_type' => 'munkak', // or 'post', 'page' 'orderby' => 'title', // or 'date', 'rand' 'order' => 'ASC', // or 'DESC' ); // Get the posts $myposts = get_posts($args); // If there are posts if($myposts): // Groups the posts in groups of $i $chunks = array_chunk($myposts, $i); $html = ""; /* * Item * For each group (chunk) it generates an item */ foreach($chunks as $chunk): // Sets as 'active' the first item ($chunk === reset($chunks)) ? $active = "active" : $active = ""; $html .= '<div class="carousel-item '.$active.'"><div class="container"><div class="row">'; /* * Posts inside the current Item * For each item it generates the posts HTML */ foreach($chunk as $post): include('variables.php'); $html .= '<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3">'; $html .= '<a class="cat-link" href="'.get_the_permalink().'">'; $html .= get_the_post_thumbnail(); $html .= '<h4>'.get_the_title($post->ID).'</h4>'; $html .= '<ul>'; $html .= '<li>'.$orszag.'</li>'; $html .= '<li>'.get_field("munkaber").'</li>'; $html .= '</ul>'; $html .= '</a>'; $html .= '</div>'; endforeach; $html .= '</div></div></div>'; endforeach; // Prints the HTML echo $html; endif; ?> </div> <!-- carousel inner --> <!-- Controls --> <div class="job-carousel carousel-control-wrapper"> <a class="carousel-control-prev" data-target="#promo-carousel" role="button" data-slide="prev"> <i class="fas fa-chevron-left"></i> <span class="sr-only">Previous</span> </a> <a class="carousel-control-next" data-target="#promo-carousel" role="button" data-slide="next"> <i class="fas fa-chevron-right"></i> <span class="sr-only">Next</span> </a> </div> </div> <!-- /carousel -->
Custom Post Type Taxonomy Archive Page in Genesis
Create a file with name taxonomy-yourtaxonomy.php
<?php //Include taxonomy template file add_action('genesis_entry_header', 'add_custom_category'); function add_custom_category(){ include('loop/taxonomy-archive.php'); } //Add wrapper open add_action('genesis_before_while', 'add_grid_wrapper_open'); function add_grid_wrapper_open(){ echo '<div class="grid row"> '; } //Add wrapper close add_action('genesis_after_endwhile', 'add_grid_wrapper_close'); function add_grid_wrapper_close(){ echo ' </div>'; } genesis();
Create another file in loop folder with name taxonomy-archive.php
<div class="card melo"> <a href="<?php the_permalink(); ?>"> <?php the_post_thumbnail( 'full', array('class' => 'card-img-top') ); ?> </a> <div class="card-body"> <h4 class="card-title"><?php the_title(); ?></h4> <div class="card-text"> </div> </div> </div>
How to add Featured Image to Custom Post Type Sidebar in Genesis
//ADD FEATURED IMAGE TO CUSTOM POST TYPE SIDEBAR IN GENESIS function your_custom_function(){ if (is_singular( 'your_cpt' )) { the_post_thumbnail( 'medium', array('class' => '') ); } } add_action('genesis_before_sidebar_widget_area', 'your_custom_function');
How to set Featured Image as Background Cover with Title and Sub Title
Create a hook in functions.php
//ADD COVER TO ONLY SUB PAGES function add_background_cover(){ if ( !is_front_page() ) { include('inc/cover.php'); } } add_action('genesis_after_header', 'add_background_cover');
Create a file inc/cover.php and place the following snippet in it. Don’t forget to replace the ACF slug in cover_subtitle() function!
<?php //Cover Background function cover_background() { function cover_subtitle() { if( get_field('........') ){ the_field('........') } else{ echo 'Hello World!'; } } $bgImage = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' ); if( has_post_thumbnail() ){ ?> <section class="cover" style="background-image: url('<?php echo $bgImage[0]; ?>'); "> <h1 class="entry-title" itemprop="headline"><?php the_title(); ?></h1> <p><?php cover_subtitle(); ?></p> </section> <?php } else{ ?> <section class="cover" style="background-image: url(..............); "> <h1 class="entry-title" itemprop="headline"><?php the_title(); ?></h1> <p><?php cover_subtitle(); ?></p> </section> <?php } } cover_background(); ?>
CSS
.cover { height: 280px; padding-top: 60px; }
How to add page title background cover to sub pages in Genesis
// ========================================================================= // ADD PAGE TITLE WITH BACKGROUND - ONLY SUB PAGES // ========================================================================= function add_page_title_background(){ if ( !is_front_page() ) { include('inc/page-title.php'); } } add_action('genesis_after_header', 'add_page_title_background');
How to add Social Icons to Genesis Menu
//ADD SOCIAL ICON TO GENESIS MENU function wdm_add_menu_items( $menu, $args ) { // check if it is the 'primary' navigation menu if ( 'primary' === $args->theme_location ) { // add the search form ob_start(); get_search_form(); $search = ob_get_clean(); $menu .= '<li id="menu-item-125" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-125"> <a href="#" target="_blank"> <i class="fb-icon fab fa-facebook-f"></i> </a> </li>'; } return $menu; } add_filter( 'wp_nav_menu_items', 'wdm_add_menu_items', 10, 2 );
How to force full width content in Genesis Custom Post Type Single Page
// Add support for Genesis layouts to listings post type add_post_type_support( 'your_post_type', 'genesis-layouts' ); // Force layout on custom post type add_filter('genesis_site_layout', 'your_post_type_layout'); function your_post_type_layout($opt) { if ( 'your_post_type' == get_post_type() ) $opt = 'full-width-content'; return $opt; }
Add support for Genesis Layouts to Custom Post Type
// Add support for Genesis layouts to custom post type add_post_type_support( 'munkak', 'genesis-layouts' );
How to move Genesis Nav Menu beside the logo
remove_action( 'genesis_after_header', 'genesis_do_nav' ); add_action( 'genesis_header_right', 'genesis_do_nav' );
How to Fix Missing Icons Bug in Simple Social Icons Plugin
1) Create a file named sprite-map.svg in yout theme folder
For example: genesis-sample/images/sprite-map.svg
2) Copy and paste this xml snippet
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;"> <symbol id="social-email" viewbox="0 0 500 600"> <path fill="currentColor" d="M502.3 190.8c3.9-3.1 9.7-.2 9.7 4.7V400c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V195.6c0-5 5.7-7.8 9.7-4.7 22.4 17.4 52.1 39.5 154.1 113.6 21.1 15.4 56.7 47.8 92.2 47.6 35.7.3 72-32.8 92.3-47.6 102-74.1 131.6-96.3 154-113.7zM256 320c23.2.4 56.6-29.2 73.4-41.4 132.7-96.3 142.8-104.7 173.4-128.7 5.8-4.5 9.2-11.5 9.2-18.9v-19c0-26.5-21.5-48-48-48H48C21.5 64 0 85.5 0 112v19c0 7.4 3.4 14.3 9.2 18.9 30.6 23.9 40.7 32.4 173.4 128.7 16.8 12.2 50.2 41.8 73.4 41.4z"></path> </symbol> <symbol id="social-facebook" viewbox="0 0 500 600"> <path fill="currentColor" d="M400 32H48A48 48 0 0 0 0 80v352a48 48 0 0 0 48 48h137.25V327.69h-63V256h63v-54.64c0-62.15 37-96.48 93.67-96.48 27.14 0 55.52 4.84 55.52 4.84v61h-31.27c-30.81 0-40.42 19.12-40.42 38.73V256h68.78l-11 71.69h-57.78V480H400a48 48 0 0 0 48-48V80a48 48 0 0 0-48-48z"></path> </symbol> <symbol id="social-youtube" viewbox="0 0 500 600"> <path fill="currentColor" d="M186.8 202.1l95.2 54.1-95.2 54.1V202.1zM448 80v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48zm-42 176.3s0-59.6-7.6-88.2c-4.2-15.8-16.5-28.2-32.2-32.4C337.9 128 224 128 224 128s-113.9 0-142.2 7.7c-15.7 4.2-28 16.6-32.2 32.4-7.6 28.5-7.6 88.2-7.6 88.2s0 59.6 7.6 88.2c4.2 15.8 16.5 27.7 32.2 31.9C110.1 384 224 384 224 384s113.9 0 142.2-7.7c15.7-4.2 28-16.1 32.2-31.9 7.6-28.5 7.6-88.1 7.6-88.1z"></path> </symbol> <symbol id="social-instagram" viewbox="0 0 500 600"> <path fill="currentColor" d="M224.1 141c-63.6 0-114.9 51.3-114.9 114.9s51.3 114.9 114.9 114.9S339 319.5 339 255.9 287.7 141 224.1 141zm0 189.6c-41.1 0-74.7-33.5-74.7-74.7s33.5-74.7 74.7-74.7 74.7 33.5 74.7 74.7-33.6 74.7-74.7 74.7zm146.4-194.3c0 14.9-12 26.8-26.8 26.8-14.9 0-26.8-12-26.8-26.8s12-26.8 26.8-26.8 26.8 12 26.8 26.8zm76.1 27.2c-1.7-35.9-9.9-67.7-36.2-93.9-26.2-26.2-58-34.4-93.9-36.2-37-2.1-147.9-2.1-184.9 0-35.8 1.7-67.6 9.9-93.9 36.1s-34.4 58-36.2 93.9c-2.1 37-2.1 147.9 0 184.9 1.7 35.9 9.9 67.7 36.2 93.9s58 34.4 93.9 36.2c37 2.1 147.9 2.1 184.9 0 35.9-1.7 67.7-9.9 93.9-36.2 26.2-26.2 34.4-58 36.2-93.9 2.1-37 2.1-147.8 0-184.8zM398.8 388c-7.8 19.6-22.9 34.7-42.6 42.6-29.5 11.7-99.5 9-132.1 9s-102.7 2.6-132.1-9c-19.6-7.8-34.7-22.9-42.6-42.6-11.7-29.5-9-99.5-9-132.1s-2.6-102.7 9-132.1c7.8-19.6 22.9-34.7 42.6-42.6 29.5-11.7 99.5-9 132.1-9s102.7-2.6 132.1 9c19.6 7.8 34.7 22.9 42.6 42.6 11.7 29.5 9 99.5 9 132.1s2.7 102.7-9 132.1z"></path> </symbol> <symbol id="social-linkedin" viewbox="0 0 500 600"> <path fill="currentColor" d="M416 32H31.9C14.3 32 0 46.5 0 64.3v383.4C0 465.5 14.3 480 31.9 480H416c17.6 0 32-14.5 32-32.3V64.3c0-17.8-14.4-32.3-32-32.3zM135.4 416H69V202.2h66.5V416zm-33.2-243c-21.3 0-38.5-17.3-38.5-38.5S80.9 96 102.2 96c21.2 0 38.5 17.3 38.5 38.5 0 21.3-17.2 38.5-38.5 38.5zm282.1 243h-66.4V312c0-24.8-.5-56.7-34.5-56.7-34.6 0-39.9 27-39.9 54.9V416h-66.4V202.2h63.7v29.2h.9c8.9-16.8 30.6-34.5 62.9-34.5 67.2 0 79.7 44.3 79.7 101.9V416z"></path> </symbol> <symbol id="social-behance" viewbox="0 0 500 600"> <path fill="currentColor" d="M232 237.2c31.8-15.2 48.4-38.2 48.4-74 0-70.6-52.6-87.8-113.3-87.8H0v354.4h171.8c64.4 0 124.9-30.9 124.9-102.9 0-44.5-21.1-77.4-64.7-89.7zM77.9 135.9H151c28.1 0 53.4 7.9 53.4 40.5 0 30.1-19.7 42.2-47.5 42.2h-79v-82.7zm83.3 233.7H77.9V272h84.9c34.3 0 56 14.3 56 50.6 0 35.8-25.9 47-57.6 47zm358.5-240.7H376V94h143.7v34.9zM576 305.2c0-75.9-44.4-139.2-124.9-139.2-78.2 0-131.3 58.8-131.3 135.8 0 79.9 50.3 134.7 131.3 134.7 61.3 0 101-27.6 120.1-86.3H509c-6.7 21.9-34.3 33.5-55.7 33.5-41.3 0-63-24.2-63-65.3h185.1c.3-4.2.6-8.7.6-13.2zM390.4 274c2.3-33.7 24.7-54.8 58.5-54.8 35.4 0 53.2 20.8 56.2 54.8H390.4z"></path> </symbol> </svg>
3) Call this file with an action hook in functions.php
function add_sprite_map(){ include('images/sprite-map.svg'); } add_action('genesis_before', 'add_sprite_map');
Add featured image to Genesis single post
How to Move Genesis Nav Above the Header
//How to Move Genesis Nav Above the Header remove_action( 'genesis_after_header', 'genesis_do_nav' ); add_action( 'genesis_before_header', 'genesis_do_nav' );
Add Full Width Wrap to Genesis Site-Inner
.entry { background-color:transparent; } .site-inner { max-width: none; } @media only screen and (max-width: 1139px) { .site-inner{max-width: none;} }
Genesis page template
<?php /** * Template name: Sales */ //Sales cover add_action('genesis_after_header', 'add_sales_cover'); function add_sales_cover(){ include('inc/sales-cover.php'); } genesis();