- This topic has 4 replies, 2 voices, and was last updated 3 years, 11 months ago by David.
-
AuthorPosts
-
May 14, 2020 at 7:36 am #1284115Matt
Is it possible to set an element to not display for logged in users?
I have a header element that includes google stuff that I’d like not to load for me. I don’t need to be included in pageviews and adverts.
Is there a way to use the options included to do this or would I have to do it with php functions.
I currently do something similar in my child themes functions.php so frontend users don’t have the dashicons loaded to save a bit of css loading time as below.
// Remove dashicons in frontend for unauthenticated users
add_action( ‘wp_enqueue_scripts’, ‘go_dequeue_dashicons’ );
function go_dequeue_dashicons() {
if ( ! is_user_logged_in() && !is_page( array( 9, 10 ) ) && !in_category( array( 29, 2 ) ) ) {
wp_deregister_style( ‘dashicons’ );
}
}Also, in a similar vein are there are any other styles or functions I could remove for non logged in users so I can shave down ever more code?
May 14, 2020 at 7:53 am #1284340MattAlso, I have a few images that aren’t being resized as I think they should be. GT metrix is showing that the three images from either my sidebar Latest Posts, or my custom WP Show Posts box “Related posts” at the bottom of blog pages the aren’t being resized. This also seems to be affecting the images in the “Standard” WP posts box from the front page.
I’m pretty sure these are the boxes that aren’t resizing at least.
Neither define an image size though they do have the css suggested under the Header Image css from https://gpsites.co/dispatch/using-wp-show-posts/ if this makes a difference at all.
The front page has six images reportedly not being resized
https://gtmetrix.com/reports/www.climbernews.com/S55UUP3nA blog page which just has the sidebar related posts and another related posts below has three images not resized in html
https://gtmetrix.com/reports/www.climbernews.com/ffVg16acThe Related Posts thing is a hook I put together containing the following code as an element
<div class="wpsp-card"> <h2 text-align=center>Related Posts</h2> <?php if ( is_single() ) { $cats = get_the_category(); $cat = $cats[0]; } else { $cat = get_category( get_query_var( 'cat' ) ); } $cat_slug = $cat->slug; $list = get_page_by_title( 'related', 'OBJECT', 'wp_show_posts' ); wpsp_display( $list->ID, 'tax_term="' . $cat_slug . '"' ); ?> </div>
It shows after content on posts and uses the data generated by WP Show Posts plugin. At least I think it does, I mash together things half the time and they mostly work.
May 14, 2020 at 9:30 am #1284490DavidStaffCustomer SupportHi there.
You can choose Logged out ( or IN ) in Elements > Display Rules > User.
I suggest a new topic for the other request – will make it easier for us to fix each issue 🙂
May 14, 2020 at 10:33 am #1284613MattThanks!
May 15, 2020 at 1:11 am #1285226DavidStaffCustomer SupportYou’re welcome
-
AuthorPosts
- You must be logged in to reply to this topic.