Utenti online in WPtouch Mobile Plugin

Tra i plugin che consentono al nostro sito web di diventare adatti ad una visualizzazione su dispositivi mobili quello che ritengo essere il migliore per i siti sotto WordPress è WPtouch Mobile Plugin. Tra le opzioni consentite vi è la possibilità di visualizzare in fondo al post le categorie di appartenenza e i tag di competenza, ma non quella di inserire le visite ricevute dal post (problema che poi ho risolto come spiegato in questo post) e quella di mostrare il numero di utenti online.

Per sopperire al problema ho quindi modificato il file

wp/wp-content/plugins/wptouch/themes/bauhaus/default/single.php

inserendo nel codice originale quanto sotto riportato evidenziato

	<div id="content">
		<?php while ( wptouch_have_posts() ) { ?>

			<?php wptouch_the_post(); ?>

			<div class="<?php wptouch_post_classes(); ?>">
				<div class="post-page-head-area bauhaus">
					<span class="post-date-comments">
						<?php if ( bauhaus_should_show_date() ) { ?>
							<?php wptouch_the_time(); ?>
						<?php } ?>
						<?php if ( bauhaus_should_show_comments() ) { ?>
							<?php if ( bauhaus_should_show_date() && ( comments_open() || wptouch_have_comments() ) ) echo '&bull;'; ?>
							<?php if ( comments_open() || wptouch_have_comments() ) comments_number( __( 'no comments', 'wptouch-pro' ), __( '1 comment', 'wptouch-pro' ), __( '% comments', 'wptouch-pro' ) ); ?>
						<?php } ?>
					</span>
					<h1 class="post-title heading-font"><?php wptouch_the_title(); ?></h1>
					<?php if ( bauhaus_should_show_author() ) { ?>
						<span class="post-author"><?php the_author(); ?></span>
					<?php } ?>
					<?php if ( bauhaus_should_show_thumbnail() && wptouch_has_post_thumbnail() ) { ?>
						<div class="post-page-thumbnail">
							<?php the_post_thumbnail('large', array( 'class' => 'post-thumbnail wp-post-image' ) ); ?>
						</div>
					<?php } ?>
				</div>

				<div class="post-page-content">
					<?php wptouch_the_content(); ?>
					<?php if ( bauhaus_should_show_taxonomy() ) { ?>
						<?php if ( wptouch_has_categories() || wptouch_has_tags() ) { ?>
							<div class="cat-tags">
								<?php if ( wptouch_has_categories() ) { ?>
									<?php _e( 'Categories', 'wptouch-pro' ); ?>: <?php wptouch_the_categories(); ?><br />
								<?php } ?>
								<?php if ( wptouch_has_tags() ) { ?>
									<?php _e( 'Tags', 'wptouch-pro' ); ?>: <?php wptouch_the_tags(); ?>
								
								<!-- rows added by MZ -->
									<br />
								<!-- end -->
								
								<?php } ?>
								
								<!-- rows added by MZ -->
								<?php if(function_exists('the_views')) { 
									$visite = the_views(false);
									$visite = str_replace(" visite","", $visite);
									echo "Visite: ".$visite; } ?>
								<br />
								<div id="useronline-browsing-site">Utenti: 
								<?php if (function_exists('get_users_browsing_site')): ?>
									<?php echo get_users_browsing_site(); ?>
								<?php endif; ?>
								</div>
								<!-- end -->
								
							</div>
						<?php } ?>
					<?php } ?>
				</div>
			</div>

		<?php } ?>
	</div> <!-- content -->

così che il numero degli utenti online venga visualizzato dopo il numero di visite che ha ricevuto il post. Il codice non ha bisogno di particolari commenti, ed il risultato lo potete vedere nello screenshot qui sotto relativo alla pagina web dell’articolo Plugin utilizzati.

Lascia un commento