Skip to content

Instantly share code, notes, and snippets.

Ike Ten IkeTen

Block or report user

Report or block IkeTen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@IkeTen
IkeTen / content-section.php
Last active Jan 6, 2017
Template for Page Sections with Cornerstone
View content-section.php
<?php
/**
* @package GeneratePress
*/
// No direct access, please
if ( ! defined( 'ABSPATH' ) ) exit;
?>
<?php
$articlesclasses = array(
@IkeTen
IkeTen / image.php
Created Dec 7, 2016 — forked from ollietreend/image.php
Disable WordPress media attachment page by redirecting to the parent post. Original idea from: http://www.wpbeginner.com/wp-tutorials/how-to-disable-image-attachment-pages-in-wordpress/
View image.php
<?php
/**
* Disables the media attachment page by redirecting the user elsewhere.
* Save as 'image.php' in theme.
* Inspired by http://www.wpbeginner.com/wp-tutorials/how-to-disable-image-attachment-pages-in-wordpress/
*/
if ($post->post_parent) {
wp_redirect(get_permalink($post->post_parent), 301);
} else {
@IkeTen
IkeTen / gist:e4a9835608af522e003916ae200429a4
Created Dec 4, 2016 — forked from generatepress/gist:9282385984459c7ac6f2
Remove the core mobile.css file and add your own to your child theme
View gist:e4a9835608af522e003916ae200429a4
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' );
}
@IkeTen
IkeTen / gist:68d5ca151b7765ad7b1714a36f192926
Created Dec 4, 2016 — forked from generatepress/gist:c23aef2d05807c39bb32
Initiate the mobile menu at your desired width
View gist:68d5ca151b7765ad7b1714a36f192926
@media (max-width: 768px) {
.menu-toggle,
.main-navigation.toggled .main-nav > ul {
display: block;
}
.main-navigation ul li.sfHover > ul,
.main-navigation ul {
display: none;
}
View 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';
} ?>
View gist:f0076068afd6430b67b590ccbcb7adf8
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(
View gist:facefa820f5e378324ff61211f2b0c8b
<?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:8a329052df89da4cb71400c91ca47b59
Created Nov 16, 2016 — forked from anonymous/gist:1519659
Excluded featured from main category query
View gist:8a329052df89da4cb71400c91ca47b59
<?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 / is_blog.php
Created Nov 14, 2016 — forked from wesbos/is_blog.php
WordPress is_blog()
View is_blog.php
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'; } ?>
View lc-extended-templates.txt
**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
You can’t perform that action at this time.