Skip to content

Instantly share code, notes, and snippets.

View renventura's full-sized avatar

Ren Ventura renventura

View GitHub Profile
<?php //* Mind this opening php tag
//* Remove Post Info, Post Meta from CPT
add_action ( 'get_header', 'rv_cpt_remove_post_info_genesis' );
function rv_cpt_remove_post_info_genesis() {
if ( 'post' !== get_post_type() ) {
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
}
}
@renventura
renventura / remove-categories-blog-index.php
Created September 10, 2014 18:01
Remove Specific Post Categories from the Blog Index
<?php //* mind this opening php tag
//* Exclude categories from blog page
add_filter('pre_get_posts', 'rv_exclude_blog_categories');
function rv_exclude_blog_categories($query) {
if ($query->is_home) {
$query->set('cat', '-1,-2,-3'); //Replace with your category numbers (keep negative signs)
}
return $query;
}
@renventura
renventura / tactile-buttons.css
Created September 24, 2014 05:46
CSS for tactile button links.
a.tactile-button {
display: block;
background: #f4f4f4;
color: #000017;
text-align: center;
padding: 20px 0;
margin-bottom: 10px;
border-radius: 10px;
border-bottom: 4px solid #ccc;
width: 100%;
@renventura
renventura / reposition-page-title-before.php
Last active August 29, 2015 14:08
How to Display a Custom Page Title in Genesis (Part 1/3)
<?php //* Mind this opening PHP tag
//* Reposition Page Title
add_action( 'genesis_before', 'centric_post_title' );
function centric_post_title() {
if ( is_page() and !is_page_template() ) {
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
add_action( 'genesis_after_header', 'centric_open_post_title', 1 );
add_action( 'genesis_after_header', 'genesis_do_post_title', 2 );
@renventura
renventura / reposition-page-title-after.php
Last active August 29, 2015 14:08
How to Display a Custom Page Title in Genesis (Part 2/3)
<?php //* Mind this opening PHP tag
//* Reposition Page Title
add_action( 'genesis_before', 'centric_post_title' );
function centric_post_title() {
if ( is_page() && !is_page_template() ) {
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
add_action( 'genesis_after_header', 'centric_open_post_title', 1 );
add_action( 'genesis_after_header', 'genesis_do_post_title', 2 );
@renventura
renventura / reposition-page-title-additional-functions.php
Created October 24, 2014 17:59
How to Display a Custom Page Title in Genesis (Part 3/3)
<?php //* Mind this opening PHP tag
function centric_open_post_title() {
echo '<div class="page-title"><div class="wrap">';
}
function centric_close_post_title() {
echo '</div></div>';
}
@renventura
renventura / shortcodes-with-custom-fields.php
Created October 28, 2014 22:05
How to Create Shortcodes that Pull Custom Fields
<?php //Mind this opening PHP tag
/****************************************************************
Project Shortcode
****************************************************************/
// Add Project Details Shortcode
add_shortcode( 'project_info', 'project_info' );
function project_info( $atts ) {
@renventura
renventura / cpt-custom-sidebar.php
Created November 6, 2014 18:08
Replace the Primary Sidebar in Genesis with a custom sidebar for custom post types
<?php //* Mind this opening PHP tag
/**
* Register the sidebar for our CPT
* Goes in functions.php
*/
genesis_register_sidebar( array(
'id' => 'project-sidebar',
'name' => __( 'Project Sidebar', 'textdomain' ),
@renventura
renventura / cot-home-page.php
Created November 21, 2014 01:45
Show recent custom post types on your blog's home page rather than Posts.
<?php //* Mind the opening PHP tag
/*
* Changes the main query on the home page (blog posts index) to one or more custom post types
*/
add_filter( 'pre_get_posts', 'my_custom_query' );
function my_custom_query( $query ) {
if ( $query->is_main_query() && $query->is_home() ) {
@renventura
renventura / custom-profile-fields.php
Created November 21, 2014 06:36
Remove default social fields and add custom fields in user profile settings.
<?php //* Mind this opening PHP tag
/*
* Removes the standard WordPress profile settings for Twitter, Google+ and Facebook
* Adds custom fields for Twitter, Facebook, LinkedIn and Google+
* Removing and adding Twitter, Google+ and Facebook is not completely necessay
* I did this so I knew exactly what these fields were doing
*/
//* Add custom meta fields