Skip to content

Instantly share code, notes, and snippets.

View IkeTen's full-sized avatar

Ike Ten IkeTen

View GitHub Profile
@lukecav
lukecav / functions.php
Last active November 8, 2016 22:42
capital_C_dangit - Forever eliminate "Woocommerce" from the planet (or at least the little bit we can influence)
/**
* Forever eliminate "Woocommerce" from the planet (or at least the little bit we can influence).
*
* Violating our coding standards for a good function name.
*
* @since 2.7.0
*
* @staticvar string|false $dblq
*
* @param string $text The text to be modified.
@generatepress
generatepress / gist:cc2d8b578c8c3706dcefe68234ca5c9f
Created July 20, 2016 06:40
show the category description only on the first page, generate_archive_title()
if ( ! function_exists( 'generate_archive_title' ) ) :
/**
* Build the archive title
*
* @since 1.3.24
*/
add_action( 'generate_archive_title','generate_archive_title' );
function generate_archive_title()
{
?>
@generatepress
generatepress / gist:2e17bb5378db0d3cfe12
Last active April 14, 2020 07:06
Replace back to top icon with an image
add_filter( 'generate_back_to_top_output', 'tu_custom_back_to_top_icon' );
function tu_custom_back_to_top_icon() {
printf(
'<a title="%1$s" rel="nofollow" href="#" class="generate-back-to-top" style="opacity:0;visibility:hidden;" data-scroll-speed="%2$s" data-start-scroll="%3$s">
<img src="URL TO YOUR IMAGE" alt="Back to top" />
<span class="screen-reader-text">%5$s</span>
</a>',
esc_attr__( 'Scroll back to top','generatepress' ),
absint( apply_filters( 'generate_back_to_top_scroll_speed', 400 ) ),
absint( apply_filters( 'generate_back_to_top_start_scroll', 300 ) ),
@generatepress
generatepress / gist:a4dad1626caeeb3e1726
Created November 24, 2015 08:02
Move the featured image above the navigation (when set to below header)
add_action( 'wp','generate_move_featured_image' );
function generate_move_featured_image()
{
remove_action('generate_after_header','generate_featured_page_header', 10);
add_action('generate_after_header','generate_featured_page_header', 4);
}
@generatepress
generatepress / gist:9282385984459c7ac6f2
Last active December 4, 2016 09:49
Remove the core mobile.css file and add your own to your child theme
add_action( 'wp_enqueue_scripts', 'generate_replace_mobile', 100 );
function generate_replace_mobile() {
wp_dequeue_style( 'generate-mobile-style' );
wp_enqueue_style( 'custom-mobile-style', get_stylesheet_directory_uri() . '/css/mobile.css', false, GENERATE_VERSION, 'all' );
}
@generatepress
generatepress / functions.php
Created August 1, 2015 07:59
Remove padding from around your post images in GeneratePress
function generate_remove_post_image_padding()
{
if ( function_exists( 'generate_spacing_get_defaults' ) ) :
$spacing_settings = wp_parse_args(
get_option( 'generate_spacing_settings', array() ),
generate_spacing_get_defaults()
);
@generatepress
generatepress / gist:c23aef2d05807c39bb32
Last active January 14, 2019 22:35
Initiate the mobile menu at your desired width
@media (max-width: 768px) {
.main-navigation .menu-toggle,
.main-navigation .mobile-bar-items,
.sidebar-nav-mobile:not(#sticky-placeholder) {
display: block;
}
.main-navigation ul,
.gen-sidebar-nav {
display: none;
@gabrielmerovingi
gabrielmerovingi / myCRED Front End Editor
Created March 28, 2014 23:18
Example of a simple adjustment form for myCRED that can be used from the front.
add_shortcode( 'mycred_manual_adjustments', 'mycred_render_manual_adjustments' );
function mycred_render_manual_adjustments( $atts, $content = NULL ) {
// Must be logged in
if ( ! is_user_logged_in() ) return;
// myCRED must be enabled
if ( ! function_exists( 'mycred' ) ) return 'myCRED is not installed';
// Load myCRED
$mycred = mycred();
@alana-mullen
alana-mullen / Detect the last post in the WordPress loop
Last active May 29, 2023 16:50
Detect the last post in the WordPress loop
<?php if (($wp_query->current_post +1) == ($wp_query->post_count)) {
echo 'This is the last post';
} ?>
<?php if (($wp_query->current_post +1) != ($wp_query->post_count)) {
echo 'This is the not the last post';
} ?>
@charleslouis
charleslouis / custom-search-acf-wordpress.php
Last active December 15, 2023 09:11
PHP - Wordpress - Search - wordpress custom search function that encompasses ACF/advanced custom fields and taxonomies and split expression before request
<?php
/**
* [list_searcheable_acf list all the custom fields we want to include in our search query]
* @return [array] [list of custom fields]
*/
function list_searcheable_acf(){
$list_searcheable_acf = array("title", "sub_title", "excerpt_short", "excerpt_long", "xyz", "myACF");
return $list_searcheable_acf;
}