Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch 2 #40

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
<div class="post-box-archive">
<span class="hdate"><?php the_time('j F y'); ?></span>

<?php if (!is_category()) { ?>
<?php
/* mostra il tipo "Pagina / Articolo" solo se: "non è una categoria" e "non si è richiesto un tipo specifico"*/
$tipo= $_GET['post_type'];
if (!is_category() && (!($tipo == 'post' || $tipo == 'page'))) { ?>
<span class="hdate" style="font-weight:normal;"><?php echo get_post_type_object(get_post_type())->labels->singular_name; ?></span>
<?php } ?>

Expand Down
60 changes: 47 additions & 13 deletions include/moduli/pasw2015-destinatari.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ function paswdestinatari_func($atts)
'anno' => 'all',
'link' => 'si',
'ordine' => 'date', //vuoto: post -> data // pagine -> alfabetico
'riassunto' => 'no'
), $atts));

if ($utente == '') {
Expand All @@ -79,7 +80,7 @@ function paswdestinatari_func($atts)
} else {
$tipo_cpt = "Contenuti";
//Sarà necessario fare una query per ogni CPT
$tipo = 'post,page';
$tipo = 'post,page';
}

$utente_cpt = strtolower(get_term_by( 'slug', $utente, 'paswdestinatari' )->name);
Expand All @@ -90,8 +91,16 @@ function paswdestinatari_func($atts)

$returner .= '</h3>';

$returner .= '<small>Visualizzazione di ' . $numero . ' ' . strtolower($tipo_cpt) . ' in ordine per ' . $ordine;
if ($anno != '') { $returner .= ' inserite nel ' . $anno; }
if ($tipo == 'page') {
$genere .= 'e';
} else {
$genere .= 'i';
}


$returner .= '<small>Visualizzazione di ' . $numero . ' ' . strtolower($tipo_cpt) . ' ordinat' . $genere . ' per ' . $ordine;

if ($anno != '') { $returner .= ' inserit' . $genere . ' nel ' . $anno; }

$returner .= ' &bull; <a href="' . add_query_arg( 'post_type', $tipo , get_term_link( $utente, 'paswdestinatari' ) );
$returner .='">Tutti i contenuti per ' . $utente_cpt . ' &raquo;</a>';
Expand All @@ -103,10 +112,9 @@ function paswdestinatari_func($atts)

foreach ($arrayposttypes as $ciao) {

$returner .= '<ul>';

if (count($arrayposttypes) > 1) {
$returner .= '<h4>' . get_post_type_object( $ciao )->labels->name . '</h4>';

if (count($arrayposttypes) > 1) {
$returner .= '<p><h4>' . get_post_type_object( $ciao )->labels->name . '</h4></p>';
}

if (strtolower(get_post_type_object( $ciao )->labels->singular_name) == "pagina") {
Expand All @@ -128,24 +136,50 @@ function paswdestinatari_func($atts)
'paswdestinatari' => $utente )
);

if ($ciao == "page") {
$returner .= '<p>';
}

if ( have_posts() ) : while ( have_posts() ) : the_post();
global $post;

if (strtolower(get_post_type_object( $ciao )->labels->singular_name) == "articolo") {
$returner .= '<li>';
$returner .= '<div style="float:right;"><small>' . get_the_date() . '</small></div>';
$returner .= '<a href="' . get_the_permalink() . '">' . get_the_title() . '</a>';
$returner .= '</li>';

$returner .= '<div class="post-box-archive">';
$returner .= '<span class="hdate">' . get_the_time('j F y') . '</span>';

if ( $riassunto =='si' ) {
$id= get_the_id();
if ( has_post_thumbnail($id) ) {
$returner .= '<a href="' . get_the_permalink() . '">';
$returner .= get_the_post_thumbnail($id, array(100,100));
$returner .= '</a>';
}
}

$returner .= '<h4 class="piccino"><a href="' . get_the_permalink() . '">' . get_the_title() . '</a></h4>';
if ( $riassunto =='si' ) {
$returner .= '<div class="piccino">';
$returner .= '<p>' . get_the_excerpt() . '</p>';
$returner .= '</div>';
}
$returner .= '</div>';

} else if (strtolower(get_post_type_object( $ciao )->labels->singular_name) == "pagina") {
$returner .= '<a href="' . get_the_permalink() . '">' . get_the_title() . '</a> &bull; ';
}


endwhile; else:
$returner .= 'Nessun risultato...';
$returner .= 'Spiacenti, nessun contenuto per questa categoria.';
endif;

if ($ciao == "page") {
$returner .= '</p>';
}


wp_reset_query();
$returner .= '</ul>';
}


Expand Down