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 / composer-template.lua
Created March 29, 2014 23:49
corona: Composer Template
local composer = require( "composer" )
local scene = composer.newScene()
--------------------------------------------------------------------------------
-- All code outside of the listener functions will only be executed ONCE
-- unless "composer.removeScene()" is called.
--------------------------------------------------------------------------------
-- local forward references should go here
--------------------------------------------------------------------------------
@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 / song_of_the_sea.rb
Last active February 18, 2018 20:07
sonic_pi: the song of the sea
# Sonic Pi 2.11
set_volume! 1
##| Link to the samples folder:
samples_dir = "/Users/srdjan/Dropbox Srdjan/Dropbox/Projects/Sonic_Pi/song_by_sea/samples/"
##| There is 99.9999% chance that your link is different. Change it to point to your dir...
use_synth_defaults pulse_width: 0.99, coef: 0.45
# -------------------- CONTROL --------------------
@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' );