Skip to content

Instantly share code, notes, and snippets.

@srdjan-m
srdjan-m / genesis-custom-loop.php
Created January 28, 2020 16:56
genesis: replace default loop with custom loop https://www.genesissnippets.com/2012/09/15/genesis-custom-loop/ Genesis comes with a handy function called genesis_custom_loop(). It’s an easy way for you to create a new loop without having to write all the code to create a new loop with WP_Query manually. Here’s how you can use it in your theme. T…
/** Replace the standard loop with our custom loop */
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'child_do_custom_loop' );
function child_do_custom_loop() {
global $paged; // current paginated page
global $query_args; // grab the current wp_query() args
$args = array(
'category__not_in' => 42, // exclude posts from this category
@srdjan-m
srdjan-m / remove-featured-image.php
Created January 28, 2020 16:54
genesis: remove featured image from entry content
/**
* Remove Entry Header
*/
function prefix_remove_entry_header() {
if ( ! is_front_page() ) { return; }
//* Remove the entry header markup (requires HTML5 theme support)
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
@srdjan-m
srdjan-m / next-and-previous-page-labels.php
Created January 28, 2020 16:53
genesis: customize next and previous page link text
add_filter( 'genesis_prev_link_text', 'modify_previous_link_text' );
function modify_previous_link_text($text) {
$text = 'Your Custom Previous Link Text';
return $text;
}
/**
* @author Brad Dalton
* @example http://wpsites.net/web-design/customize-genesis-next-previous-page-link-text/
* @copyright 2014 WP Sites
*/
@srdjan-m
srdjan-m / wp-config.php
Created July 8, 2018 11:24
wordpress: wp-config.php file options
// Revisions (doesn't work?)
define( 'WP_POST_REVISIONS', 5 );
// Disable automtic updates
define('AUTOMATIC_UPDATER_DISABLED', true );
// Get rid of the code editor
define('DISALLOW_FILE_EDIT', true);
@srdjan-m
srdjan-m / welcome.pde
Created February 16, 2018 20:02
Bezier line animation in Processing
float x1, y1;
float x2, y2;
float x3, y3;
float x4, y4;
int frame = 0;
PImage title;
float a = 0;
@srdjan-m
srdjan-m / genesis-change-searchfield.php
Created July 29, 2017 12:26
genesis: change text in searchfield
function themeprefix_search_button_text( $text ) {
return ( 'Search text goes here...');
}
add_filter( 'genesis_search_text', 'themeprefix_search_button_text' );
@srdjan-m
srdjan-m / genesis-custom-fields-hide-title.php
Created June 10, 2017 18:03
genesis: hide title with custom fields
// You need is_title_visible = false custom field in a page or post.
// "false" is the only value which will trigger the code to hide a page title.
// For posts
add_action( 'loop_start', 'remove_titles_all_single_posts' );
function remove_titles_all_single_posts() {
if ( is_singular('post') ) {
$cust_fld_title_visible = get_post_meta(get_the_ID(), "is_title_visible", true);
if ($cust_fld_title_visible == "false") {
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
@srdjan-m
srdjan-m / genesis-remove-sidebars.php
Last active February 12, 2017 18:19
genesis: remove sidebars
// Remove sidebars
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
remove_action( 'genesis_sidebar_alt', 'genesis_do_sidebar_alt' );
@srdjan-m
srdjan-m / featured-post-widget.php
Last active February 3, 2017 00:40
genesis: customised "Genesis - Featured Posts" widget which adds the posts category class
<?php
/**
* Genesis Framework.
*
* WARNING: This file is part of the core Genesis Framework. DO NOT edit this file under any circumstances.
* Please do all modifications in the form of a child theme.
*
* @package Genesis\Widgets
* @author StudioPress
* @license GPL-2.0+