• Resolved gabrieldiggs

    (@gabrieldiggs)


    WordPress is overiding my page template with the archive function and I need to disable it altogether.I have two pages using the same template with only the category differing between the two. One page displays in the intended grid format https://www.gabrieldiggs.com/radio/ The other page will only display in Archive list format https://www.gabrieldiggs.com/mixes/ and I cannot for the life of me figure out how to disable the archive function for the page. I’ve tried everything from changing the name of the category and url string to loading other templates and nothing works to put the page in its intended grid format. I’d like to disable Archives altogether. To be clear I do not want to hide archive pages. I want to strip the very function of Archives from my wordpress install and theme as if it never existed. Is this possible?

    • This topic was modified 2 years, 2 months ago by gabrieldiggs.
    • This topic was modified 2 years, 2 months ago by gabrieldiggs.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Well, rather than ripping apart WordPress core functionality, I think you’ll have it much easier if you stick to the way WordPress is designed to work.

    It seems you have a category named “mixes”, as well as a page with the same slug “mixes”.

    Normally this shouldn’t be a problem: your page will live at example.com/mixes, and your category will live at the URL example.com/category/mixes.

    But it seems you’re having this issue because you removed the URL prefix /category/‘ which WordPress adds to avoid exactly this kind of problem.

    So you have two resources now, a page and a category, both with the same URL example.com/mixes. Thus there is a conflict, and it seems the category is winning this war.

    Yo may:

    1) Give the page a different slug
    2) Give the category a different slug
    3) Revert whatever you did to remove the category prefix /category/, so you can have both the category and page using the same slug.

    If you truly want to disable WordPress’ archiving feature completely (a whole lot of work for virtually no benefit), look for a plugin that can customize the default POST post type to disable archiving.

    But note that once you disable the archiving feature from the POSTs, then your POST post type becomes almost identical to the default PAGE post type. In that case, why don’t you simply create PAGEs alone and not POSTs at all?

    Good luck!

    Thread Starter gabrieldiggs

    (@gabrieldiggs)

    Hi George,
    Thanks for your advice. Unfortunately I can’t get it working. I renamed the mixes category and slug to something unique and the page will only display in list archive format. Nothing I have tried can stop it from displaying in list format which is why I want to go the scorched earth route and remove the archive function altogether. I know there are plug-ins that can make grid pages for categories but I’d like to avoid having to install a plug-in for something that should be easy to fix natively. Is there a way to force the page to render in grid format? A way to tell archive pages to ignore any auto-formatting?

    • This reply was modified 2 years, 2 months ago by gabrieldiggs.
    Thread Starter gabrieldiggs

    (@gabrieldiggs)

    I just tried doing it the other way and renamed the page and page slug to somethign unique and the page still displays in list archive format. I’ve put everything back to Mixes mixes on both page and category now and looking for a solution.

    Thread Starter gabrieldiggs

    (@gabrieldiggs)

    Alright this is getting really weird. I think the issue I’m facing has absolutely NOTHING to do with categories or archives. Is there a maximum number of grid pages one can have with wordpress? It seems that I am limited to having a maximum of two grid pages. Any additional pages using the grid template (under custom named files) will not load as grid and only load as list view. To be clear I have two php files in my theme’s directory that include the grid template. If I try to include a third file with the grid template any page using that third grid template will not load as grid but will only load in list view.

    TL;DR: The grid vs list issue is a problem in your CSS, not WordPress. You’re missing the body class for the template used for the “mixes” page in your CSS block for the grid.

    WordPress doesn’t care whether you present your content in a grid or list format. That’s just eye candy, and it would be crazy for WordPress to dictate this, let alone put an arbitrary limit.

    The important things are:

    • What WordPress decides should be served on that URL (is this a PAGE? POST? Some ARCHIVE? etc). When I checked your /mixes/ URL earlier, a WordPress category archive was served there. Now I see a WordPress page at the same URL.
    • The template file used (and here the name given to your template file may play a role, due to template hierarchy)
    • The code in the template file and its associated CSS styling

    Check your public pages’ HTML body classes. That should give you an indication of the template file used to present that particular page.

    Your /radio/ and /mixes/ pages respectively have these:

    <body class="page-template page-template-blog_r page-template-blog_r-php page page-id-4855">

    <body class="page-template page-template-blog_m page-template-blog_m-php page page-id-10671">

    So you’re using a template file named page-template-blog_r.php for the Radio page, and a different template file named page-template-blog_m.php for the Mixes page.

    Now, in your theme’s style.css, you have the following CSS block which creates your grid with a fixed width of 260px.

    body.page-template-blog_g-php .post.type-post, body.page-template-galleries-php .gallery.type-gallery, body.page-template-blog_r-php .post.type-post, body.page-template-galleries-php .gallery.type-gallery {
    float: left;
        width: 260px;
        background: rgba(0,0,0,0.6);
        margin-bottom: 20px;
        padding: 20px;
    }

    Do you see the problem in the above code and why you’re getting the grid on the Radio page but not on the Mixes page? The Mixes page’s body class (the specific class from the template file) is not in the above selector at all. In fact, I didn’t find it anywhere in your stylesheet.

    In summary…

    1) The two pages are using different templates
    2) One of the templates has no associated CSS to force the grid display

    Just add body.page-template-blog_m-php .post.type-post to the CSS block for the grid. Alternatively, you may target a common selector, so you don’t have to tweak the grid’s CSS every time you create another page template.

    Thread Starter gabrieldiggs

    (@gabrieldiggs)

    Ohh man. Thank you SO much. I actually did a search for a specific occurence of the term “blog_g” in my template folder because I had a hunch there was something specific in my theme that might be stytling it. Unfortuantely my finder search only turned up the file blog_g.php itself and not the code buried in the styles.css :-S I appreciate you support and careful explanation. Updating my CSS now.

    Update: That fixed it!

    • This reply was modified 2 years, 2 months ago by gabrieldiggs.
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Strip the archive function from WordPress’ is closed to new replies.