[Resolved] Changes of announcement's and widget's title.

Home Forums Support [Resolved] Changes of announcement's and widget's title.

Home Forums Support Changes of announcement's and widget's title.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1110849
    Maxim

    Hi, dear developer.

    Your theme is pretty good =) i am happy to use it but i would like to make some little changes.
    Could you explain to me how and where i can make changes for announcement’s and widget’s titles.
    Now i have headings there but i want to make just divs or spans without using any headings because it is not so good for SEO.
    I should use H1-H6 only for structuring of articles but not in announcment’s and widget’s titles.
    Whre can i find php files (names) and what exactly do i have to change?

    Thanks a lot for your support =)

    #1110865
    Leo
    Staff
    Customer Support

    Hi there,

    I’m not quite sure what you are announcement you are referring to?

    Can you explain a bit more?

    As for widget title, this should help:
    https://docs.generatepress.com/article/generate_start_widget_title/
    https://docs.generatepress.com/article/generate_end_widget_title/

    #1110872
    Maxim

    Hi =)

    we have:

    1. <header class-“entry-header”> (these are titles of announcments)
    <h2 class=”entry-title”>…</h2>
    </header>

    I want to remove h2 from it and replace with div. I assume, there some php file where i have to change

    2. <aside id=”archives-2> (this is widget’s titles)
    <h2 class=”widget-title”>…</h2>
    </aside>

    Here i want to remove all h2 in widgets and replace with div for all widgets.

    I think, there is some php file, and i have to make some changes.

    3. <h3 class=”reply-title> (this is the button: Leave a comment)
    I want to remove all h3 tags and replace with div.
    I suppose there is some php file but i don’t know where and what do i have to change/

    I want to use h1-h6 tags only for structurization of articles but not for mark up others things in layout

    #1110876
    Leo
    Staff
    Customer Support

    1. <h2> is very common for posts titles and I believe it’s important for SEO.

    I don’t think it’s a good idea to remove that but if you still want to do it, then you’d need to use a child theme, copy the content.php file and paste in your child theme’s folder then edit this line:
    https://github.com/tomusborne/generatepress/blob/master/content.php#L34

    2. The filter I provided above should do.

    3. Same thing as #1. You’d need to copy comments.php then modify this line:
    https://github.com/tomusborne/generatepress/blob/master/comments.php#L44

    #1110898
    Maxim

    Hi Leo,
    I think it is not what i wanted. Maybe these screenshots help:
    https://ibb.co/KszhYVN
    https://ibb.co/ng54QP7
    https://ibb.co/pQ4B63n

    I want to change Heading tags for divs only for certain elements: anounncment’s tile, widget’s title and button “Leave a comment”.
    These 3 elements are not content or article. H tags must not be placed there =) because these tags (h1-h6) are used only for structurization of articles but not for widget’s name (widget’s title should not be wrapped in h2). If i have the same h1 and h2 this will lead to cannibalization (because h1 in the article is the same like h2 in announcment). And i don’t need to have “Leave a Comment” wrapped in h3.

    that is really defficult to explain =)) Thank a lot for your suport =)))

    #1110902
    Maxim

    finally i have found how to change announcment’s title h2 fot div tag =)))) hurray!!
    https://ibb.co/QdpkH0j
    https://ibb.co/ZXtrsCK

    But where can i wrap widdet’s title in div instead of h2??
    And Where is it possible to wrap button “Leave a comment” in just div tag??

    Thanks a lot for your help =))))))

    #1110913
    Leo
    Staff
    Customer Support
    #1111535
    Maxim

    Hi, Leo.

    I created a childtheme and then placed in it functions.php, content.php. I have made changes in these 2 files (in childtheme). All works nicely =)

    But if i create and copy general.php (in childtheme) changes aren’t working from there. It seems general.php not to be seen form the childtheme. i can make changes in general.php in parenttheme directly but if themplate updates i will lose all my changes. That’s problem. How could i solve it?
    Screenshot is here: https://ibb.co/hMBXCG9

    Thanks a lot =)))

    #1111808
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    general.php isn’t a template file, so it can’t be overwritten in your child theme.

    Instead, use these functions in your functions.php file:

    add_filter( 'generate_start_widget_title', function() {
        return '<div class="widget-title">';
    } );
    
    add_filter( 'generate_end_widget_title', function() {
        return '</div>';
    } );
    #1112430
    Maxim

    Hi Tom, all works ok =). Could you explain to me what diffrence between hook and filter?
    Are filters and hooks the same things?

    Thangs a lot.

    #1112464
    Leo
    Staff
    Customer Support
Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.