Skip to content

Instantly share code, notes, and snippets.

View IkeTen's full-sized avatar

Ike Ten IkeTen

View GitHub Profile
<?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';
} ?>
@IkeTen
IkeTen / gist:68d5ca151b7765ad7b1714a36f192926
Created December 4, 2016 09:16 — forked from generatepress/gist:c23aef2d05807c39bb32
Initiate the mobile menu at your desired width
@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;
}
@IkeTen
IkeTen / gist:e4a9835608af522e003916ae200429a4
Created December 4, 2016 09:49 — forked from generatepress/gist:9282385984459c7ac6f2
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' );
}
@IkeTen
IkeTen / image.php
Created December 7, 2016 16:28 — 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/
<?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 / content-section.php
Last active January 6, 2017 18:51
Template for Page Sections with Cornerstone
<?php
/**
* @package GeneratePress
*/
// No direct access, please
if ( ! defined( 'ABSPATH' ) ) exit;
?>
<?php
$articlesclasses = array(