Skip to content

Instantly share code, notes, and snippets.

View IkeTen's full-sized avatar

Ike Ten IkeTen

View GitHub Profile
@IkeTen
IkeTen / gist:e048440cad321414a803e335d0bb50f4
Created October 15, 2016 23:32 — forked from generatepress/gist:a4dad1626caeeb3e1726
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);
}
@IkeTen
IkeTen / template-tags.php
Created October 16, 2016 22:38 — forked from generatepress/template-tags.php
Add "Previous" and "Next" text before next/prev links on single.php
if ( ! function_exists( 'generate_content_nav' ) ) :
/**
* Display navigation to next/previous pages when applicable
*/
function generate_content_nav( $nav_id ) {
global $wp_query, $post;
// Don't print empty markup on single pages if there's nowhere to navigate.
if ( is_single() ) {
@IkeTen
IkeTen / custom-search-acf-wordpress.php
Created October 23, 2016 07:06 — forked from charleslouis/custom-search-acf-wordpress.php
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;
}
@IkeTen
IkeTen / gist:ef9613bc81a613601159379d5b58de1a
Created October 29, 2016 05:30 — forked from generatepress/gist:cc2d8b578c8c3706dcefe68234ca5c9f
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()
{
?>
@IkeTen
IkeTen / gist:eaddbf3559f1c12423d9c0c96a6a2138
Created October 29, 2016 05:33 — forked from generatepress/gist:a2e15b0eaae6edca8324
Add the time to the published and modified date in generate_posted_on()
if ( ! function_exists( 'generate_posted_on' ) ) :
/**
* Prints HTML with meta information for the current post-date/time and author.
*/
function generate_posted_on() {
if ( 'post' !== get_post_type() )
return;
$date = apply_filters( 'generate_post_date', true );
**Directions**
** Copy the below import code (line 6 entirely) and import it into LiveComposer! Wala! **
[dslc_modules_section show_on="desktop tablet phone" type="wrapper" columns_spacing="spacing" bg_color="rgb(0,190,198)" bg_image_thumb="disabled" dslca-img-url="" bg_image="" bg_image_repeat="no-repeat" bg_image_position="right top" bg_image_attachment="fixed" bg_image_size="auto" bg_video="" bg_video_overlay_color="rgb(0,190,198)" bg_video_overlay_opacity="0" border_color="" border_width="0" border_style="solid" border="top right bottom left" margin_h="0" margin_b="0" padding="120" padding_h="12" custom_class="" custom_id="" ] [dslc_modules_area last="no" first="yes" size="8"] [dslc_module last="yes"]YToyMjp7czo3OiJjb250ZW50IjtzOjc4OiI8aDM+SEVBRElOR8KgPC9oMz48aDE+U2hvcnQgbG9pbiBwb3JjaGV0dGEgdmVuaXNvbiBwYXN0cmFtaS4gUHJhY3RpY2FsLsKgPC9oMT4iO3M6MTc6ImNzc19tYXJnaW5fYm90dG9tIjtzOjI6IjMwIjtzOjEyOiJjc3NfaDFfY29sb3IiO3M6MTY6InJnYigyNTUsMjU1LDI1NSkiO3M6MTY6ImNzc19oMV9mb250X3NpemUiO3M6MjoiNTAiO3M6MTg6ImNzc19oMV9
@IkeTen
IkeTen / is_blog.php
Created November 14, 2016 03:06 — forked from wesbos/is_blog.php
WordPress is_blog()
function is_blog () {
global $post;
$posttype = get_post_type($post );
return ( ((is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag())) && ( $posttype == 'post') ) ? true : false ;
}
Usage:
<?php if (is_blog()) { echo 'You are on a blog page'; } ?>
@IkeTen
IkeTen / gist:8a329052df89da4cb71400c91ca47b59
Created November 16, 2016 19:47 — forked from anonymous/gist:1519659
Excluded featured from main category query
<?php
function be_exclude_category_featured( $query ) {
if( $query->is_main_query() && $query->is_category() ) {
$meta_query = array(
array(
'key' => 'be_category_featured',
'value' => 'on',
'compare' => '!='
);
@IkeTen
IkeTen / gist:facefa820f5e378324ff61211f2b0c8b
Created November 16, 2016 19:47 — forked from anonymous/gist:1519651
Category Featured Query
<?php
$args = array(
'cat' => get_query_var( 'cat' ),
'posts_per_page' => '-1',
'meta_query' => array(
array(
'key' => 'be_category_featured',
'value' => 'on'
)
@IkeTen
IkeTen / gist:f0076068afd6430b67b590ccbcb7adf8
Created November 20, 2016 15:00 — forked from generatepress/gist:2e17bb5378db0d3cfe12
Replace back to top icon with an image
if ( ! function_exists( 'generate_back_to_top' ) ) :
/**
* Build the back to top button
*
* @since 1.3.24
*/
add_action( 'wp_footer','generate_back_to_top' );
function generate_back_to_top()
{
$generate_settings = wp_parse_args(