[Resolved] Don't display element for logged in users

Home Forums Support Don't display element for logged in users

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #1284115

    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?


    Also, 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

    A blog page which just has the sidebar related posts and another related posts below has three images not resized in html

    The 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>
    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 . '"' );

    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.

    Customer Support

    Hi 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 🙂



    Customer Support
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.