/* wp show posts pagination simplify */
.wpsp-load-more .page-numbers {
display: none;
}
.wpsp-load-more .prev,
.wpsp-load-more .next {
display: inline-block; padding: 1%;
}
.wpsp-load-more .next {float: right;}
code snippets
comment smackdown
// Disable comments and hide from admin menu and admin bar in functions.php
add_action('admin_init', function () {
// Redirect any user trying to access comments page
global $pagenow;
if ($pagenow === 'edit-comments.php') {
wp_redirect(admin_url());
exit;
}
// Remove comments metabox from dashboard
remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal');
// Disable support for comments and trackbacks in post types
foreach (get_post_types() as $post_type) {
if (post_type_supports($post_type, 'comments')) {
remove_post_type_support($post_type, 'comments');
remove_post_type_support($post_type, 'trackbacks');
}
}
});
// Close comments on the front-end
add_filter('comments_open', '__return_false', 20, 2);
add_filter('pings_open', '__return_false', 20, 2);
// Hide existing comments
add_filter('comments_array', '__return_empty_array', 10, 2);
// Remove comments page in menu
add_action('admin_menu', function () {
remove_menu_page('edit-comments.php');
});
// Remove comments links from admin bar
add_action('init', function () {
if (is_admin_bar_showing()) {
remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60);
}
});
css reset generatepress / elementor
/* Custom CSS by Dave Foy - https://www.designbuildweb.co - hello@designbuildweb.co */
/* Use the same method of sizing elements as Elementor does */
body * {
box-sizing: border-box;
}
/* Fix for horizontal wiggle on iPhone with GeneratePress - thanks Lyle Chamney from http://snifflevalve.com/ */
html, body {
max-width: 100% !important;
overflow-x: hidden !important;
}
/* Elementor - set some default left and right padding on mobile - same as in GeneratePress */
.elementor-top-section.elementor-section-boxed > .elementor-container {
padding: 0 20px;
}
/* 1. Don't set padding if an Elementor library item is embdedded within another section via shortcode */
/* 2. Don't set padding if an Elementor library item is embdedded within a standard non-full width page */
.elementor-top-section .elementor-top-section.elementor-section-boxed > .elementor-container,
body:not(.full-width-content) .entry-content .elementor-top-section.elementor-section-boxed > .elementor-container {
padding: 0;
}
/* 3. Don't set padding if the section has a class of 'nopad' */
.elementor-top-section.elementor-section-boxed.nopad > .elementor-container {
padding: 0;
}
/* Make Elementor elements expand to fit the full available width. This is due to how Elementor puts padding all the way around columns */
.elementor-section-boxed .elementor-column-gap-default .elementor-row {
width: calc(100% + 20px);
margin-left: -10px;
margin-right: -10px;
}
.elementor-section-boxed .elementor-column-gap-narrow .elementor-row {
width: calc(100% + 10px);
margin-left: -5px;
margin-right: -5px;
}
.elementor-section-boxed .elementor-column-gap-extended .elementor-row {
width: calc(100% + 30px);
margin-left: -15px;
margin-right: -15px;
}
.elementor-section-boxed .elementor-column-gap-wide .elementor-row {
width: calc(100% + 40px);
margin-left: -20px;
margin-right: -20px;
}
.elementor-section-boxed .elementor-column-gap-wider .elementor-row {
width: calc(100% + 60px);
margin-left: -30px;
margin-right: -30px;
}
responsive adjust
/******************** smaller media mobile adjustments ************************ */
/******************** smaller media mobile adjustments ************************ */
/******************** smaller media mobile adjustments ************************ */
/******************** smaller media mobile adjustments ************************ */
/* very large screens HUGE */
@media (min-width: 1824px) {
/* comment */
/* END very large screens HUGE */ }
/* Portrait tablet to landscape and desktop LAPTOP */
@media (min-width: 768px) and (max-width: 1024px) {
/* comment */
/* END Portrait tablet to landscape and desktop */}
/* Landscape phone to portrait tablet TABLET */
@media (max-width: 767px) {
/* comment */
/* END Landscape phone to portrait tablet */}
/* Landscape phones and down PHONE*/
@media (max-width: 480px) {
/* comment */
/* END Landscape phones and down */}
avoid side to side slide
html, body {
max-width: 100%;
overflow-x: hidden;
}
nice drop shadow for text
text-shadow: 0px 2px 4px #000000;
call menu with shortcode
// call menu with shortcode [menu name="main-menu"]
function print_menu_shortcode($atts, $content = null) {
extract(shortcode_atts(array( 'name' => null, ), $atts));
return wp_nav_menu( array( 'menu' => $name, 'echo' => false ) );
}
add_shortcode('menu', 'print_menu_shortcode');
do shortcode
<?php echo do_shortcode('[catlist id=1 numberposts=5)]'); ?>
compression and cacheing
<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
# Remove browser bugs (only needed for really old browsers)
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
</IfModule>
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 2 days"
</IfModule>
## EXPIRES CACHING ##
latest comments
$args = array (
'status' => 'approve',
'number' => '5'
);
$comments = get_comments( $args );
if ( !empty( $comments ) ) :
echo '<ul>';
foreach( $comments as $comment ) :
echo '<li><a href="' . get_permalink( $comment->comment_post_ID ) . '#comment-' . $comment->comment_ID . '">' . $comment->comment_author . ' on ' . get_the_title( $comment->comment_post_ID ) . '</a></li>';
endforeach;
echo '</ul>';
endif;