Skip to content

Instantly share code, notes, and snippets.

View srikat's full-sized avatar

Sridhar Katakam srikat

View GitHub Profile
@PurpleHippoDesign
PurpleHippoDesign / display-gallery-as-soliloquy-dynamic-slider.php
Last active October 3, 2015 02:18
Removing ACF front end dependency
@bradpotter
bradpotter / functions.php
Last active August 29, 2015 14:21
Register a sidebar for a page that has a page template selected
add_action('widgets_init', 'gpb_register_sidebar');
/**
* Dynamically register sidebar for pages that use specified template
*
*/
function gpb_register_sidebar() {
global $post;
global $wp_registered_sidebars;
// Find all pages that use template with dynamic sidebar
@ohiosveryown
ohiosveryown / change-class-on-scroll.html
Last active May 9, 2024 16:56
Vanilla JS – change/add class based on scroll position.
// https://codepen.io/cmykw/pen/gemxJm
// layout
<nav/>
// style
<style>
body { min-height: 200vh; }
nav {
@timothyjensen
timothyjensen / functions.php
Last active February 5, 2018 14:58
Get an auto generated post excerpt, or a manual excerpt if one has been set.
<?php
// Make sure to prefix the function if you do not use a namespace.
// namespace TimJensen\HelperFunctions;
/**
* Returns an auto generated post excerpt, or a manual excerpt if one has been set.
*
* @version 1.2.1
*
* @param int $post_id Required. Post ID.
@robincornett
robincornett / functions.php
Created October 31, 2017 15:16
Code to remove landing pages from site search results. Assumes that templates are in the templates directory inside the theme.
<?php
add_action( 'pre_get_posts', 'leaven_search_hide_landing_page' );
/**
* Remove landing pages from the search results.
*
* @param $query \WP_Query
*
* @return mixed
*/
@badabingbreda
badabingbreda / oxygenbuilder2_manage_edit_column_apply_to.php
Last active July 16, 2018 00:50
Oxygenbuilder2 Template overview Add Column "Apply To" and "In Use"
<?php
/**
* Add a apply_to and in_use column to Oxygenbuilder2.0's ct_templates overview.
* It will:
* - tell you the rules on the templates
* - show you if a re-usable is being used on a post/page/cpt so if not, you can safely delete it.
*/
add_filter('manage_edit-ct_template_columns', 'add_new_ct_template_columns');
/**
@yankiara
yankiara / oxygen-repeater-dynamic-query.php
Last active September 6, 2023 19:25
Use dynamic queries with Oxygen's repeater
/* I'll put here different examples of dynamic query for Oxygen repeater :
* - Use one of the following repeater_dynamic_query definitions
* in code block just BEFORE the repeater
* - Set the repeater custom query settings : post type, number of posts, order...
* - Add the remove_action in a code block AFTER the repeater
*/
/****************************************************************************************************
* Display related posts for any CPT with taxonomy: