[Resolved] Overwrite Existing Content With A Hook

Home Forums Support [Resolved] Overwrite Existing Content With A Hook

Home Forums Support Overwrite Existing Content With A Hook

Viewing 15 posts - 1 through 15 (of 24 total)
  • Author
    Posts
  • #978496
    Heather

    I am trying to customize my category archive page, and I am able to create a hook that pulls in all the posts for a specific category, but I can only place it above or below the “main content”, which are the same posts just styled differently.

    Is there an option to have that hook be the only content that appears on the page, and the original content is gone? I tried to also check off all of the boxes in Appearance > Customize > Layout > Blog that was available, but unfortunately the title of the posts are still visible, and there does not seem to be a way to get rid of it. If there is a way to get rid of these that would be great as well? (there is no actual category archive page that exists in pages that I can access to do it manually).

    #978542
    Leo
    Staff
    Customer Support

    Hi there,

    I’m not quite sure if I fully understand.

    Any chance you can link us to the site in question so I can see your current set up and issues?

    You can edit the original topic and use the private URL field.

    Let me know ๐Ÿ™‚

    #979153
    Heather

    Unfortunately I can not link you to the page as it is on a dev server. I will try to explain with images.

    I have a sidebar that lists all of the categories/tags that exist, so that when they are clicked it will take you to a page that shows all the blog posts that contain that tag. The existing category archive page is not the design I want, so I am creating a hook that is a custom version of the category archive page, and placing it “before_content” or “before_main_content”, and I would like to essentially remove or “hide” the existing content on the category archive pages with the new content I am making in the hook.
    In Appearance > Customize > Layout > Blog, I have checked off all of these options for the archives so that no content or author information would show up.Archive Content Selectors.
    But, even after all that, I am still left with all of the titles Category Archive Titles
    I want to also find a way to remove all of these titles, so that only my new code/content/design shows up from my hook- new category archive content
    So those titles always exist above my new content/design, because I don’t know how to get rid of them. I tried to find a hook location that would overwrite it, but I can’t seem to find one as it is always before or after content – hook location

    Normally, for things like the blog archive page or something, there is an actual page you can go to delete things. I also tried to go into the posts with those titles and hide the title using the little eye icon beside the title when creating a new blog post, it still appears.

    Can you tell me how to get rid of these titles so that I can only have my content/design show up on the page when a category is clicked on from the sidebar.

    #979306
    Leo
    Staff
    Customer Support

    Hmm I don’t think that’s the best way to modify the archive/category pages.

    What if you just create static pages for them and list them out in the sidebar widget?

    I can’t tell where the title is with screenshots unfortunately.

    Any chance you can set up a staging site so we can provide better assistance?

    Let me know ๐Ÿ™‚

    #979381
    Heather

    What do you mean static pages and list them out in the sidebar widget? It’s the main body of the content for those pages, not a sidebar. I have a right sidebar already.

    And those titles are above all of my custom content. As for the hook I placed it after_content or something to test where it shows up.

    I can create static pages, as I’ve done that for the blog post archive, but I don’t think there is a way to create one static page that will dynamically render the blog posts of a specific category once it’s clicked on from a sidebar or another link. Also, because of the way the elements are set up when you select the location for the display rules, there’s no way for the blog itself to know to direct people to that page when a category is selected, as that’s all pre-determined by wordpress.

    Unfortunately no there’s no way to create a staging site for you.

    #979382
    Heather

    If you have a better suggestion, please let me know.

    #979383
    David
    Staff
    Customer Support

    Hi there,

    what is the difference between the Hooked content and the original archive content?
    Are they both showing the same posts and its just a matter of a different style?

    Let us know.

    #979831
    Heather

    The Hooked content and archive content are the same yes, so – for example, if I have a sidebar with 10 categories, and one of them being tacos, when I click on tacos it will take me to a category archive page that shows all the posts with the category of taco.

    I have made custom php code to bring in that same content through a hook, because the styling I am doing I cannot add directly to elements/classes on the original, as there is not enough differentiation between them throughout the site – ie: there are many “inner-container”, “entry-content”, etc and I can’t style them differently from page to page. So, I needed to create this hook in order to bring in the content with custom classes so I can style it a specific way.

    The issue is that on the archive page, say for “tacos”, when I have my hook displayed and all the archive content checked off from the Appearance > Customize > Layout > Blog (see photo from a few posts ago), the titles still remain (see photo from a few posts ago). I want to know if there is a way to get rid of these titles from showing up so that ONLY my hooked content appears, as I was able to get rid of everything else that is related to the posts. I am trying not to display:none a section.

    #979835
    Heather

    Note: the titles appear first, and then my hooked content because of where I am putting the hook, but they sometimes show up before the hooked content if I place it as before_content. See photo – custom hooked content appears below the pagination numbers, titles of the posts with same categories appear above in blue.
    titles and hook

    #979839
    Heather

    sorry wrong photo: titles and hook

    #979986
    David
    Staff
    Customer Support

    You can use the body-classes to target a specific page or archive.
    So for your Taco category there would be a body class of category-taco.

    So you could style the various elements specifically for that page.

    Let me know if i misunderstood.

    #980020
    Heather

    It may be possible, the issue with this is that it adds a lot more css code as I would have to do it for each category and be very explict with targeting – ie: .blog-taco .inside article or .blog-taco .inside-article .entry-summary p
    Also, if a new category gets added, I would have to go and add all of this code with the .blog-whatever each time. Since this is for a company it needs to be dynamic to just update and pull in the information/styling regardless of what they do to a category/post/whatever. So I have to use the custom hook.

    #980022
    David
    Staff
    Customer Support

    How many different style Category archives will there be?
    And how do you determine which category gets which style?

    #980039
    Heather

    Well, there’s as many archives as there are categories – every category has it’s own archive, and every category archive page is going to look the same because it needs to be consistent. So if there are 10 different categories, each one is going to have it’s own archive page and they will all look the same.
    So I have all the styling done for the archive pages, I just need those titles to disappear..

    #980040
    Heather

    ie: that hook currently has the display rule “Post Category Archive – All Categories” so that it is applied to everything

Viewing 15 posts - 1 through 15 (of 24 total)
  • You must be logged in to reply to this topic.