Suporte » Ajustando o WordPress » problema com o arquivo de uma categoria, preciso de ajuda

  • bom dia povo do bem, estou desenvolvendo um portal, é um site de um jornalista de minha cidade, tudo tem corrido muito bem, no entanto estou enfrentando um problema em 2 categorias, ambas usam arquivo de mídia como base, uma de áudio, outra de vídeo.
    No arquivo de postagens (utilizo ele no menu) estava aparecendo somente o título e resumo do artigo como é padrão no site, no entanto como estas categorias era postado apenas o titulo da reportagem, a imagem de destaque e o arquivo de mídia, só aparecia o título da notícia e a imagem de destaque.
    Para tentar solucionar editei o código da categoria para aparecer a postagem completa, ao invés de apenas o resumo, então usei este comando:
    <?php
    while ( have_posts() ) {
    the_post();
    the_content();
    get_template_part( ‘loop’, ‘category’ );
    } ?>
    apareceu a mídia, no entanto, ela aparece antes do título e da imagem de destaque do artigo, gostaria de fazer a mídia aparecer depois do título e da imagem de destaque.
    Estaria usando o comando “the_content();” de forma errada? tentei colocar ele em outros locais e não tive sucesso…
    Teria outro comando que eu poderia usar aí para fazer esta função?
    Alguém tem uma sugestão de como eu poderia resolver isto de outra forma?

    Desde já agradeço

Visualizando 15 respostas - 1 até 15 (de um total de 16)
  • desculpe gostari de te ajudar mas fiquei meio confuso poderia postar uma print desse pedaço da página para eu ver se consigo entender melhor?

    Criador do tópico Sandro Luís Baraldi

    (@caboclo)

    Kelvin-mariano obrigado por tentar me ajudar, vamos lá
    aqui está o post:

    como pode ver o título está acima da mídia

    e no arquivo da categoria sai a mídia encima no título
    o campo cinza não aparece no site só na imagem que eu criei

    acho que entendi, qual é o nome do arquivo que você esta fazendo essa edição?.
    faz o seguinte procura o arquivo category.php e coloca o the_content(); após a chamada da thumbnail. pelo que entendi você esta fazendo o seguinte:

    primeiro ele começa o loop ai ele chama o conteudo e depois ele abre o category e chama o title e a thumbnail;

    va no pasta do seu tema e abra o arquivo category.php procure pelo titulo ou pela foto e coloque o the_content(); após eles isso ja vai resolver.

    Criador do tópico Sandro Luís Baraldi

    (@caboclo)

    bom se eu fizer a mudança no category.php vai mudar a página inicial, ou não? estou mudando apenas de uma categoria que é controlado pelo arquivo category-radio.php, vou postar o código completo:

    <?php
    /**
    * The category archive template file
    *
    * @package Graphene
    * @since Graphene 1.1.5
    */
    global $graphene_settings;
    get_header(); ?>
    </br>
    <h1 class=”page-title archive-title”>
    <?php
    printf( __( ‘<span>%s</span>’, ‘graphene’ ), single_cat_title( ”, false ) );
    ?>
    </p>
    <p class=”page-title archive-title” style=”text-align: center”>Oração com Julião Pitbull</p>
    <div class=”entries-wrapper”>
    <audio controls>
    <source src=”http://olimpia24horas.com.br/oracaoradio24horas.ogg&#8221; type=”audio/ogg”>
    <source src=”http://olimpia24horas.com.br/oracaoradio24horas.mp3&#8243; type=”audio/mp3″>
    </audio>
    <p>
    <?php graphene_tax_description(); ?>
    <?php
    /**
    * Run the loop for the category page to output the posts.
    * If you want to overload this in a child theme then include a file
    * called loop-category.php and that will be used instead.
    */
    while ( have_posts() ) {
    the_post();
    the_content();
    get_template_part( ‘loop’, ‘category’ );
    }
    ?>
    </div>
    <?php graphene_posts_nav(); ?>
    <?php get_footer(); ?>

    estou pensando em mudar o padrão do site, pois lá tem a função de mudar todo o site exibindo o conteúdo completo, inclusive na página inicial, o que não quero que ocorra, como o site ainda não está no ar, e ver se muda mais alguma coisa
    será que eu teria que criar o arquivo loop-radio.php e tentar mudar este arquivo?

    faz o seguinte vc tem o arquivo loop-category.php né?

    faz uma cópia deste arquivo e renomeia como loop-category-radio.php

    e posta o código dele por favor

    Criador do tópico Sandro Luís Baraldi

    (@caboclo)

    não tem o loop-category.php
    tem somente:
    loop.php
    loop-single.php
    loop-post-formats.php
    loop-page.php
    loop-not-found.php
    loop-children.php
    loop-autor.php

    devo criar o loop-category-radio.php? qual o arquivo que usaria como modelo, o loop-single.php ou o loop.php?

    Criador do tópico Sandro Luís Baraldi

    (@caboclo)

    olha copiei o loop.php e criei o loop-category-radio.php
    e ficou assim:

    <?php
    global $graphene_settings;
    $post_type = get_post_type_object( get_post_type() );
    ?>
    <?php
    /**
    * Check if the post has a post format. Load a post-format specific loop file,
    * if it has. Continue with standard loop otherwise.
    */
    if ( function_exists( ‘get_post_format’ ) && $post_type->name != ‘page’ ) {
    global $post_format;
    $post_format = get_post_format();
    // Get the post formats supported by the theme
    $supported_formats = get_theme_support( ‘post-formats’ );
    if ( is_array( $supported_formats ) ) $supported_formats = $supported_formats[0];
    if ( in_array( $post_format, $supported_formats ) ) {
    // Get the post format loop file
    get_template_part( ‘loop-post-formats’, $post_format );
    // Stop this default posts loop
    return;
    }
    }
    ?>
    <?php if ( $post_type->name == ‘page’ && $graphene_settings[‘hide_parent_content_if_empty’] && $post->post_content == ” ) : ?>
    <h1 class=”page-title”>
    <?php if ( get_the_title() == ” ) { _e( ‘(No title)’, ‘graphene’ ); } else { the_title(); } ?>
    </h1>
    <?php else : ?>
    <div id=”post-<?php the_ID(); ?>” <?php post_class( ‘clearfix post’ ); ?>>
    <?php do_action( ‘graphene_before_post’ ); ?>
    <div class=”entry clearfix”>
    <?php /* Post date is not shown if this is a Page post */ ?>
    <?php if ( stristr( graphene_post_date_setting( get_the_ID() ), ‘icon’ ) ) graphene_post_date(); ?>
    <?php /* Show the post author’s gravatar if enabled */
    if ( $graphene_settings[‘show_post_avatar’] ) {
    echo ‘<div class=”post-avatar-wrap gutter-left”>’ . get_avatar( get_the_author_meta( ‘user_email’ ), 45 ) . ‘</div>’;

    }

    ?>

    <?php

    /* Add a print button only for single pages/posts

    * and if enabled in the theme option.

    */

    if ( $graphene_settings[‘print_button’] && is_singular() ) : ?>

    <?php graphene_print_button(); ?>

    <?php endif; ?>

    <?php /* Add an email post icon if the WP-Email plugin is installed and activated */

    if( function_exists( ‘wp_email’ ) && is_singular() ) { echo ‘<p class=”email wp-email-button”>’; email_link(); echo ‘</p>’; }

    ?>

    <?php /* Post title */ ?>

    <h2 class=”post-title entry-title”>

    ” rel=”bookmark” title=”<?php printf( esc_attr__( ‘Permalink to %s’, ‘graphene’ ), the_title_attribute( ‘echo=0’ ) ); ?>”>

    <?php if ( get_the_title() == ” ) { _e( ‘(No title)’, ‘graphene’ ); } else { the_title(); } ?>

    <?php do_action( ‘graphene_post_title’ ); ?>

    </h2>

    <?php /* Post meta */ ?>

    <?php if ( $post_type->name != ‘page’ || is_user_logged_in() ) : ?>

    <div class=”post-meta clearfix”>

    <?php /* Post category, not shown if admin decides to hide it */ ?>

    <?php if ( ( $graphene_settings[‘hide_post_cat’] != true ) ) : ?>

    <span class=”printonly”><?php _e( ‘Categories:’, ‘graphene’ ); ?> </span>

    <p class=”meta_categories”><?php the_category( “, ” ); ?></p>

    <?php endif; ?>

    <?php /* Edit post link, if user is logged in */ ?>

    <?php if ( is_user_logged_in() ) : ?>

    <p class=”edit-post”>

    <?php edit_post_link( sprintf( __( ‘Edit %s’, ‘graphene’ ), $post_type->labels->singular_name ), ‘ (‘, ‘)’ ); ?>

    </p>

    <?php endif; ?>

    <?php /* Inline post date */ ?>

    <?php if ( graphene_post_date_setting( get_the_ID() ) == ‘text’ ) graphene_post_date(); ?>
    <?php /* Post author, not shown if this is a Page post or if admin decides to hide it */ ?>
    <?php if ( $post_type->name != ‘page’ && $graphene_settings[‘hide_post_author’] != true ) : ?>
    <p class=”post-author author vcard”>
    <?php
    /* translators: this is for the author byline, such as ‘by John Doe’ */ $author_url = ‘‘ . get_the_author_meta( ‘display_name’ ) . ‘‘;
    printf( __( ‘by %s’, ‘graphene’ ), ‘<span class=”fn nickname”>’ . apply_filters( ‘graphene_author_url’, $author_url ) . ‘</span>’ );
    ?>
    </p>
    <?php endif; ?>
    <?php /* For printing: the date of the post */
    if ( $graphene_settings[‘print_css’] && graphene_should_show_date() ) { echo graphene_print_only_text( get_the_time( get_option( ‘date_format’ ) ) );
    }
    ?>
    <?php do_action( ‘graphene_post_meta’ ); ?>
    </div>
    <?php endif; ?>
    <?php /* Post content */ ?>
    <div class=”entry-content clearfix”>
    <?php do_action( ‘graphene_before_post_content’ ); ?>
    <?php if ( ( is_home() && !$graphene_settings[‘posts_show_excerpt’] ) || is_singular() || ( ! is_singular() && ! is_home() && $graphene_settings[‘archive_full_content’] ) ) : ?> <?php /* Social sharing buttons at top of post */ ?
    <?php if ( stripos( $graphene_settings[‘addthis_location’], ‘top’ ) !== false) { graphene_addthis( get_the_ID() ); } ?>
    <?php /* The full content */ ?>
    <?php the_content( ‘<span class=”block-button”>’ . __( ‘Read the rest of this entry »’, ‘graphene’ ) . ‘</span>’ ); ?>
    <?php else : ?>
    <?php /* The post thumbnail */
    if ( has_post_thumbnail( get_the_ID() ) ) { ?>
    <div class=”excerpt-thumb”>
    ” rel=”bookmark” title=”<?php printf( esc_attr__( ‘Permalink to %s’, ‘graphene’ ), the_title_attribute( ‘echo=0’ ) ); ?>”>
    <?php the_post_thumbnail( apply_filters( ‘graphene_excerpt_thumbnail_size’, ‘thumbnail’ ) ); ?>

    </div>
    <?php
    } else { echo graphene_get_post_image( get_the_ID(), apply_filters( ‘graphene_excerpt_thumbnail_size’, ‘thumbnail’ ), ‘excerpt’ );
    }
    ?>
    <?php /* Social sharing buttons at top of post */ ?>
    <?php if ( stripos( $graphene_settings[‘addthis_location’], ‘top’ ) !== false && $graphene_settings[‘show_addthis_archive’] ) { graphene_addthis( get_the_ID() ); } ?>
    <?php /* The excerpt */ ?>
    <?php the_excerpt(); ?>
    <?php endif; ?>
    <?php wp_link_pages( array( ‘before’ => ‘<div class=”link-pages”><p>‘ . __( ‘Pages:’,’graphene’ ) . ‘ ‘, ‘after’ => ‘</p></div>’, ‘next_or_number’ => ‘number’ ) ); ?>
    <?php do_action( ‘graphene_after_post_content’ ); ?>
    </div>
    <?php /* Post footer */ ?>
    <div class=”entry-footer clearfix”>
    <?php /* Display the post’s tags, if there is any */ ?>
    <?php if ( $post_type->name != ‘page’ && ( $graphene_settings[‘hide_post_tags’] != true) ) : ?>
    <p class=”post-tags”><?php if ( has_tag() ) { _e( ‘Tags:’, ‘graphene’ ); the_tags( ‘ ‘, ‘, ‘, ” ); } else { _e( ‘This post has no tag’,’graphene’ ); } ?></p>
    <?php endif; ?>
    <?php /* Display comments popup link. */ ?>
    <?php if ( graphene_should_show_comments() ) : ?>
    <p class=”comment-link”>
    <?php
    $comments_num = get_comments_number();
    comments_popup_link( __( ‘Leave comment’, ‘graphene’ ), sprintf( __( ‘%s comment’, ‘graphene’ ), number_format_i18n( $comments_num ) ), sprintf( _n( ‘%s comment’, ‘%s comments’, $comments_num, ‘graphene’ ), number_format_i18n( $comments_num ) ), ‘comments-link’ );
    ?>
    </p>
    <?php endif; ?>
    <?php
    /* Display AddThis social sharing button */
    if ( stripos( $graphene_settings[‘addthis_location’], ‘bottom’ ) !== false && $graphene_settings[‘show_addthis_archive’] ) { graphene_addthis( get_the_ID() ); }
    ?>
    <?php do_action( ‘graphene_post_footer’ ); ?>
    </div>
    </div>
    </div>
    <?php endif; ?>
    <?php /* For printing: the permalink */
    if ( $graphene_settings[‘print_css’]) {
    echo graphene_print_only_text( ‘<span class=”printonly url”>‘ .__( ‘Permanent link to this article:’, ‘graphene’ ). ‘ <span>’ . get_permalink(). ‘</span></span>’ );
    }
    ?>
    <?php /* Display Adsense advertising */ ?>
    <?php if ( ! is_front_page() || ( is_front_page() && $graphene_settings[‘adsense_show_frontpage’] ) ) { graphene_adsense(); } ?>
    <?php do_action( ‘graphene_loop_footer’ ); ?>

    você tem o arquivo category.php? se tiver posta ele aqui por favor

    Criador do tópico Sandro Luís Baraldi

    (@caboclo)

    vamos lá:

    <?php
    /**
    * The category archive template file
    *
    * @package Graphene
    * @since Graphene 1.1.5
    */
    get_header();
    ?>
    <?php
    echo do_shortcode(‘[smartslider2 slider=”100031″]’);
    ?>
    <div id=”ap” style=”position: absolute; left: -240px; top: -275px; z-index: 0; vertical-align: middle; visibility: visible;”>
    <img src=”../../../topofinal.png” width=”1200″ height=”180″ alt=””/>
    </div>
    <h1 class=”page-title archive-title”>
    <?php
    printf( __( ‘<span>%s</span>’, ‘graphene’ ), single_cat_title( ”, false ) );
    ?>
    </h1>
    <?php graphene_tax_description(); ?>
    <div class=”entries-wrapper”>
    <?php
    /**
    * Run the loop for the category page to output the posts.
    * If you want to overload this in a child theme then include a file
    * called loop-category.php and that will be used instead.
    */
    while ( have_posts() ) {
    the_post();
    get_template_part( ‘loop’, ‘category’ );
    }
    ?>
    </div>
    <?php graphene_posts_nav(); ?>
    <?php get_footer(); ?>

    vamos fazer um teste no arquivo loop.php vai ter um trecho escrito assim procura la
    <?php /* The post thumbnail */
    if ( has_post_thumbnail( get_the_ID() ) ) { ?>

    ai você deixa assim:

    <?php /* The post thumbnail */
    the_content();
    if ( has_post_thumbnail( get_the_ID() ) ) { ?>

    e ve se aparece alguma coisa

    Criador do tópico Sandro Luís Baraldi

    (@caboclo)

    não deu certo, alias deu certo mas fazendo a mudança no loop.php muda todo o site, inclusive a página inicial, eu quero que apenas uma categoria fizesse isto, então criei o arquivo loop-category.php e a página inicial ficou como queria mas mudou todas as categorias, eu queria que apenas em 2 categorias fizesse isto, tentei criar loop-category-radio.php mas não deu certo…
    alguma sugestão (testei também loop-radio.php, e não tive exito)?

    hehe estamos chegando la 😀

    vamos la:
    1 – faz uma cópia do arquivo loop.php e renomeia como loop-category-radio.php

    2 – dentro do arquivo que foi criado(loop-category-radio.php) faz igual no post anterior coloca o the_content() onde dei o exemplo.

    3 – no arquivo category-radio.php onde esta escrito :
    get_template_part( ‘loop’, ‘category’ );

    você coloca assim:

    get_template_part( ‘loop-category-radio’ );

    deu para entender né?

    Criador do tópico Sandro Luís Baraldi

    (@caboclo)

    funcionou, blz, muito obrigado Kelvin-mariano, vou copiar o código para o outra categoria 🙂

    Imagina 🙂 hehe demorou um pouco mas conseguimos resolver 😀

    marca o tópico resolvido 🙂

Visualizando 15 respostas - 1 até 15 (de um total de 16)
  • O tópico ‘problema com o arquivo de uma categoria, preciso de ajuda’ está fechado para novas respostas.