• Resolved Tomas Canale

    (@tomascanale)


    Hi there! Thanks for this amazing plugin.

    Everything was working correctly until I added a shortcode to a page and the cookie bar changed to the default message and style on that specific page. If I disable the snippet, the customised cookie bar shows up as it should.

    Here is the snippet code:

    function show_sites_list() {
     	if ( ! is_multisite() ) {
    	wp_die( __( 'Multisite support is not enabled.' ) );
    }
        $user_id = get_current_user_id();
        if ($user_id == 0) {
    		$html = 'Debes iniciar sesión para ver tus sitios.';
        } else {
            $user_blogs = get_blogs_of_user( $user_id );
    		$html = '';
    		$html .='<div id="myblogs" method="post">';
    		foreach ($user_blogs AS $user_blog) {
    			switch_to_blog( $user_blog->userblog_id );
    			$html .= '<div class="card">';
    			$html .= '<h3 class="card-title">'. $user_blog->blogname .'</h3>';
    
    		$actions = "<a href='" . esc_url( home_url() ) . "' target='_blank'>" . __( 'Visitar' ) . "</a>";
    
    		if ( current_user_can( 'read' ) ) {
    			$actions .= "<a href='" . esc_url( admin_url() ) . "' target='_blank'>" . __( 'Escritorio' ) . "</a>";
    		}
    
    		/**
    		 * Filters the row links displayed for each site on the My Sites screen.
    		 *
    		 * @since MU (3.0.0)
    		 *
    		 * @param string $actions   The HTML site link markup.
    		 * @param object $user_blog An object containing the site data.*/
    		
    		$actions = apply_filters( 'myblogs_blog_actions', $actions, $user_blog );
    		$html .= '<p class="my-sites-actions">' . $actions . '</p>';
    
    		/** This filter is documented in wp-admin/my-sites.php*/
    		echo apply_filters( 'myblogs_options', '', $user_blog );
    		$html .= '</div>';
    	}
    	$html .= '</div>';
     }
    	return $html;
    }
    add_shortcode( 'siteslist', 'show_sites_list' );

    I tried everything but does not work. I hope you can help me.

    Thanks!!

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Cookie Pop up changing after adding a Shortcode’ is closed to new replies.