Skip to content

Instantly share code, notes, and snippets.

Brad Dalton braddalton

Block or report user

Report or block braddalton

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@braddalton
braddalton / menus.php
Created Aug 11, 2019
Genesis Sample 2.10 Step 4 – Modify the PHP code in the config > menus.php file like this : https://wpsites.net/web-design/menu-logo-menu-in-genesis-sample-themes-header/
View menus.php
return array(
'secondary' => __( 'Footer Menu', 'genesis-sample' ),
'left' => __( 'Header Left', 'genesis-sample' ),
'right' => __( 'Header Right', 'genesis-sample' ),
);
@braddalton
braddalton / class-custom-feed.php
Created May 30, 2019 — forked from ocean90/class-custom-feed.php
How to add a custom feed to WordPress
View class-custom-feed.php
<?php
/**
* Add a custom feed to WordPress.
*
* The feed will be rendered through the wp-includes/feed-rss2.php template
* and avaiable under example.com/feed/{$feed_slug}.
*
* Note: Don't forget to flush the rewrite rules once.
*
* @author Dominik Schilling
@braddalton
braddalton / functions.php
Created May 24, 2019
Alternative Method for Using post_type_link Filter https://wp.me/p1lTu0-ghd
View functions.php
add_filter( 'post_type_link', 'my_custom_permalink', 10, 3 );
function my_custom_permalink( $permalink, $post_id, $leavename ) {
if (( strpos( $permalink, '%country-type%' ) === FALSE ) && ( strpos($permalink, '%region-type%' ) === FALSE ))
return $permalink;
$post = get_post($post_id);
if (!$post) return $permalink;
@braddalton
braddalton / functions.php
Created May 24, 2019
Custom Permalink Structure for Taxonomies Added to CPT's https://wp.me/p1lTu0-ghd
View functions.php
//* Create Golf Courses custom post type
add_action( 'init', 'golf_courses_post_type' );
function golf_courses_post_type() {
register_post_type( 'golf-courses',
array(
'labels' => array(
'name' => __( 'Golf Courses', 'genesis' ),
'singular_name' => __( 'Golf Course', 'genesis' ),
),
View front-page.php
<nav><?php
echo '<a href="#">' . get_term( '89', 'category' )->name . '</a>';
echo '<a href="#">' . get_term( '93', 'product_cat' )->name . '</a>';
echo '<a href="#">' . get_term( '94', 'portfolio-type' )->name . '</a>';
echo '<a href="#">' . get_term( '92', 'category' )->name . '</a>';
?></nav>
View markup.php
add_filter( 'genesis_attr_breadcrumb', 'genesis_attributes_breadcrumb' );
/**
* Add attributes for breadcrumbs wrapper.
*
* @since 2.2.0
*
* @param array $attributes Existing attributes for breadcrumbs wrapper element.
* @return array Amended attributes for breadcrumbs wrapper element.
*/
function genesis_attributes_breadcrumb( $attributes ) {
View class-genesis-breadcrumb.php
protected function get_post_crumb() {
$categories = get_the_category();
$cat_crumb = '';
if ( 1 === count( $categories ) ) {
// If in single category, show it, and any parent categories.
$cat_crumb = $this->get_term_parents( $categories[0]->cat_ID, 'category', true ) . $this->args['sep'];
}
View breadcrumb.php
add_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
/**
* Display Breadcrumbs above the Loop. Concedes priority to popular breadcrumb
* plugins.
*
* @since 1.0.0
*
* @return void Return early if Genesis settings dictate that no breadcrumbs should show in current context.
*/
function genesis_do_breadcrumbs() {
View functions.php
add_action( 'genesis_entry_content', 'recipe_anchor_point', 5 );
function recipe_anchor_point() {
if ( is_singular( 'post' ) ) {
printf( '<p><a href="%s" class="anchor">' . __( 'JUMP TO RECIPE' ) . '</a></p>', __( '#recipe' ) );
}
@braddalton
braddalton / functions.php
Last active Apr 15, 2019
Essence Pro Add Background Image To Footer CTA Widget https://wp.me/p1lTu0-hP5
View functions.php
'before' => '<div id="footer-cta" class="footer-cta" class="widget-area"><div class="wrap">',
You can’t perform that action at this time.