This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// WordPress Breadcrumb Function | |
function vts_breadcrumb() { | |
// Check if is front/home page, return | |
if ( is_front_page() ) { | |
return; | |
} | |
// Define | |
global $post; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Multi excerpt_length | |
*/ | |
function vts_variable_excerpt_length( $length ) { | |
global $post; | |
if ( 'post' === $post->post_type ) { | |
return 32; | |
} else if ( 'page' === $post->post_type ) { | |
return 65; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$args = array( | |
'post_type' => 'page', //write slug of post type | |
'posts_per_page' => -1, | |
'post_parent' => '26', //place here id of your parent page | |
'order' => 'ASC', | |
'orderby' => 'menu_order' | |
); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'widgets_init', 'vts_remove_default_widgets' ); | |
function vts_remove_default_widgets() { | |
unregister_widget( 'WP_Widget_Pages' ); | |
unregister_widget( 'WP_Widget_Calendar' ); | |
unregister_widget( 'WP_Widget_Archives' ); | |
unregister_widget( 'WP_Widget_Links' ); | |
unregister_widget( 'WP_Widget_Media_Audio' ); | |
unregister_widget( 'WP_Widget_Media_Image' ); | |
unregister_widget( 'WP_Widget_Media_Video' ); | |
unregister_widget( 'WP_Widget_Media_Gallery' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add search box to secondary menu | |
*/ | |
function wpgood_nav_search($items, $args) { | |
// If this is the secondary menu? | |
if( ($args->theme_location == 'menu-2') ) | |
// Add the form | |
return $items . '<li class="nav-search"><i class="fa fa-search"></i><i class="fa fa-times"></i></li>'; | |
// Otherwise just return the nav items | |
return $items; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$args = array( | |
'post_type' => 'page', | |
'posts_per_page' => -1, | |
'post_parent' => $post->ID, // Get this pages id and find the children | |
'order' => 'ASC', | |
'orderby' => 'menu_order' | |
); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Source: https://thuthuat.vip/ | |
global $post; | |
$args = array( | |
'post_type' => 'page', | |
'posts_per_page' => -1, | |
//'post_parent' => $post->ID, // Get this pages id and find the children | |
'post_parent' => array('2455', '2447'), | |
'post_parent__in' => array('2455', '2447'), | |
'order' => 'ASC', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######################################################################## | |
# OPTIMAL .htaccess FILE FOR SPEED AND SECURITY @Version 2019 | |
# ---------------------------------------------------------------------- | |
# @Author: Andreas Hecht | |
# @Author URI: https://andreas-hecht.com | |
# License: GNU General Public License v2 or later | |
# License URI: http://www.gnu.org/licenses/gpl-2.0.html | |
######################################################################## | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Delete post ajax | |
*===============================================================*/ | |
add_action('wp_ajax_moveposttotrash', function(){ | |
check_ajax_referer( 'trash-post_' . $_POST['post_id'] ); | |
wp_trash_post( $_POST['post_id'] ); | |
die(); | |
}); | |
/* Add new js in adminpage | |
*===============================================================*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(function($){ | |
$('body.post-type-post .row-actions .trash a').click(function( event ){ | |
event.preventDefault(); | |
var url = new URL( $(this).attr('href') ), | |
nonce = url.searchParams.get('_wpnonce'), // MUST for security checks | |
row = $(this).closest('tr'), | |
postID = url.searchParams.get('post'), | |
postTitle = row.find('.row-title').text(); |