Site logo

Archived topic

Archives

13 replies · Started by ROHART on March 4, 2023

Viewing posts 1–14 of 14

Hi,

I am currently changing my wordpress theme to GeneratePress (which I already use on other blogs). For this, I do it on a clone site with the WP Staging Pro plugin.

I want to edit the archive and add the date, post author name, post categories and number of comments.

I checked the boxes in Personalization ▸ Layout ▸ Blog. But nothing is displayed. I saw the tutorial to add a piece of code in the function.php file here https://docs.generatepress.com/article/option_generate_blog_settings/ but even by adding this code, nothing is displayed.

Do you have an idea to help me to resolve the problem ?

My settings

Gregory

Hi Gregory,

I checked the boxes in Personalization ▸ Layout ▸ Blog. But nothing is displayed.

Can you make sure the Blog module is activated?
https://docs.generatepress.com/article/blog-content-layout/
https://docs.generatepress.com/article/blog-content-layout/#archives

You can also consider using a block element post meta as well if you prefer to create a custom layout:
https://docs.generatepress.com/article/block-element-post-meta-template/

Let me know if this helps :)

That link isn't working for me.

Can you check? and please also take a screenshot of the Blog panel in the customizer.

Let me know :)

Hi there,

is it possible to see the staging site ?

Yes, it is. Thanks, I will check that.

You're welcome

I managed to display the date, the author's name but I can't display the custom taxonomies. How I can do that?

Hi Rohart,

Try adding a snippet to create a Shortcode for your custom taxonomy. See here for an example: https://stackoverflow.com/questions/40595724/display-custom-taxonomy-by-shortcode#:~:text=By%20default%20add_shortcode%20return%20html.%20You%20can%20try%20the%20following%20code%3A

Example:

add_shortcode( 'YOUR_SHORTCODE_NAME', 'category_in_content' );
function category_in_content($atts){
    global $post;
    $html  = '';
    $taxonomy = 'YOUR-CUSTOM-TAXONOMY-SLUG';
    $terms = get_the_terms( $post, $taxonomy );

    if ( !empty( $terms ) ) {
        foreach ($terms as $term) {
            $html .= '<a href="' . get_term_link( $term, $taxonomy ) . '">' . $term->name . '</a>';
        }
    }

    return $html;
}

Adding PHP: https://docs.generatepress.com/article/adding-php/#code-snippets

You may then add the shortcode [YOUR_SHORTCODE_NAME] through a Shortcode Block.

I find the solution in the same time. Thanks for your help.

You're welcome, Rohart!

This archived topic is closed to new replies.