Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save gregoirenoyelle/19489e5da8440adbd70b8efeb827d480 to your computer and use it in GitHub Desktop.
Save gregoirenoyelle/19489e5da8440adbd70b8efeb827d480 to your computer and use it in GitHub Desktop.
genesis-custom-markup
<?php
//* Function déclarée dans le fichier markup.php
function genesis_parse_attr( $context, $attributes = array(), $args = array() ) {
$defaults = array(
'class' => sanitize_html_class( $context ),
);
$attributes = wp_parse_args( $attributes, $defaults );
// Contextual filter.
return apply_filters( "genesis_attr_{$context}", $attributes, $context, $args );
}
<?php
// Template Name: Grid Layout 3 col
/**
* Ajouter une classe sur la balise entry-content
* @author Grégoire Noyelle
* @return $attributes
*/
add_filter('genesis_attr_entry-content', 'gn_add_entry_content_class');
function gn_add_entry_content_class($attributes) {
$attributes['class'] .= ' section-grid-layout-wrap';
return $attributes;
}
genesis();
<?php // Balise PHP à ne pas mettre
//* Ajouter un id sur la balise Nave Primary
add_filter( 'genesis_attr_nav-primary', 'gn_primary_nav_id' );
function gn_primary_nav_id( $attributes ) {
$attributes['id'] = 'mon-id-de-menu-dont-j-ai-besoin';
return $attributes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment