Author:
erics , November 19th, 2019
All credit to Graham Walters for this excellent plugin and post, upon which this post is based – thank you, sir! https://grahamwalters.me/lab/disable-wpautop-on-specific-postspages/ Recently, a client was having problems using a plugin called by a shortcode. As it turned out, the JavaScript embedded in the returned content was being broken by the WordPress auto-paragraph feature known […]
Categories: How-To's , Technology Tags: add_filter , Auto-Paragraph , autop , Disable , Filter , howto , Page , POST , Prevent , remove_filter , Stop , tips , turn off , WordPress , wpautop
| No comments
Author:
erics , November 19th, 2019
Normally, there is an option in the Screen Options menu to show or hide the Custom Fields tool. If this option is missing, you may have the plugin Advanced Custom Fields (ACF) version 5.5.13 or greater installed and active because ACF removes the Custom Fields tool to improve page load speed. If you do have […]
Categories: How-To's , Technology Tags: ACF , add_filter , Advanced Custom Fields , Custom , Custom Fields , Fields , Filter , functions.php , howto , meta , Settings , tips , WordPress , Wordpress Custom Fields
| No comments
Author:
erics , June 15th, 2018
remove_filter( ‘the_content’, ‘wpautop’ ); add_filter( ‘the_content’, ‘smart_autop’ ); function smart_autop($content) { $post = get_post(); if($post->post_type != ‘post’) return $content; // if not a post, leave $content untouched return wpautop($content); }
Categories: How-To's , Technology Tags: add_filter , autop , Disable , howto , para , POST , remove_filter , tips , WordPress , wpautop
| No comments
Author:
erics , January 19th, 2015
Simple Link
$ redirect = ( is_home ( ) ) ? false : get_permalink ( ) ;
if ( is_user_logged_in ( ) ) {
$ link = '<a href="' . wp_logout_url ( $ redirect ) . '" title="Log Out">Log Out</a>' ;
} else {
$ link = '<a href="' . wp_login_url ( $ redirect ) . '" title="Log In">Log In</a>' ;
}
echo $ link ;
Complex Menu Link
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Add login/logout links to a menu
add_filter ( 'wp_nav_menu_items' , 'add_login_logout_to_menu' , 50 , 2 ) ;
function add_login_logout_to_menu ( $ items , $ args ) {
// change theme location with your them location name
$ myMenu = 'secondary' ; // or primary, etc.
if ( is_admin ( ) || $ args -> theme_location != $ myMenu ) {
return $ items ;
}
$ redirect = ( is_home ( ) ) ? false : get_permalink ( ) ;
if ( is_user_logged_in ( ) ) {
$ link = '<a href="' . wp_logout_url ( $ redirect ) . '" title="' . __ ( 'Logout' ) . '">' . __ ( 'Logout' ) . '</a>' ;
} else {
$ link = '<a href="' . wp_login_url ( $ redirect ) . '" title="' . __ ( 'Login' ) . '">' . __ ( 'Login' ) . '</a>' ;
}
$ items . = '<li id="log-in-out-link" class="menu-item menu-type-link">' . $ link . '</li>' ;
return $ items ;
}
Categories: How-To's , Technology Tags: add_filter , howto , Link , login , Login/Logout , Logout , Menu , tips , WordPress , wp_nav_menu_items
| No comments