Support » Plugins » srg_clean_archives

  • Resolved Vera

    (@vera)


    Anyone that uses this plugin: srg_clean_archives that was successful, please let me know what I did wrong.

    My WordPress version is 1.5.1.3 and I want to make a seperate archives page. What I did was upload the plugin – active it. And I called the function <?php srg_clean_archives(); ?> in the page I’ve made called “wp-archives.php”. That’s all I have in there. And when I visit that link to the wp-archives.php page, I get this:

    Fatal error: Call to undefined function: srg_clean_archives() in /home/sleepii/public_html/vera/wp/wp-archives.php on line 1

    What did I do wrong? Thanks.

Viewing 15 replies - 1 through 15 (of 25 total)
  • If you’re using this in a PHP file that’s not part of the template/theme structure, you’ll have to include the wp-blog-header.php file so it’s “WordPress-aware.” So try changing your code to this:

    <?php
    require('./wp-blog-header.php');
    srg_clean_archives();
    ?>

    Just make sure the path to wp-blog-header.php is correct. If wp-archives.php sits in the same directory as it does, then the above should work as is.

    The other solution is to grab David Chait’s QuickPHP plugin. When you are calling just ONE LINE of PHP code, as you would be for using the Clean Archives plugin, this does the trick nicely.

    Go here:

    http://babygotblog.com/?page_id=1308

    It’s the third link down and I believe it links directly to the download.

    Basically what you do is, once you activate the plugin, substitute this:

    <quickphp srg_clean_archives(); />

    for this:

    <?php srg_clean_archives(); ?>

    @kafkaesqui:

    I tried your way and it worked perfectly, thanks :D!

    @jonimueller:

    I tried it, and it didn’t work =(. Does it have to be in a “wordpress page” so you have insert it yourself when you are making a page WITHIN wordpress. Cause right now, I’m just making a file and uploading (not directly making an archives page within WordPress) Maybe that’s why it’s not working?

    @kafkaesqui:

    Is there a way to call the header instead of the blog-header .php file??

    Cause I tried this:

    <?php
    get_header();
    ?>

    And it didn’t want to call the header.

    Until wp-blog-header.php is loaded in a page, no WordPress feature will work. With it available you can then use any WordPress function, template tag, etc., including theme template-related functions such as get_header().

    For me it works in this way:
    1. In my theme created a template called archives.php (notice the plural S at the end!)
    2. At the top of it I put the usual stuff for a Page template:
    <?php
    /*
    Template Name: Archives
    */
    ?>

    3. In the same file cleaned the div class="post" of everything and put there the code for the archives:
    <?php srg_clean_archives(); ?>
    4. Save the file in the theme directory.
    5. Write > Write Page panel: create a new Page titled “News Archives” – don’t write anything in the content area – choose from Page Templates > Archives
    6. Click the Create new Page.
    Done.

    Eep.. forget it. I just used jonimueller’s idea. I activated the plugin and used that code WITHIN a wordpress page instead of doing it seperately. – why go through all that trouble *grunts* ^-^; thanks!

    I am glad it works. I forgot to add the above described “solution” was for a new theme I’ve made. In an existing (decent) theme there should already be an archives.php template where you just have to replace the existing code with the one for the Clean Archives.
    Whatever is possible to be done WITHOUT a plugin… I like to go that way: less chances to screw up something 🙂

    @moshu:

    Okay. I tried that one – since it would be clearer (archives template page) :). It worked thanks lol. Did you ever try creating one for (pages?) Cause I tried and I put the usual stuff – and where I want my content stuff to appear, I put this code:

    <div class=”storycontent”>
    <?php the_content(__(‘read more…’)); ?>
    </div>

    But it doesn’t seem to work o__O;; – content disappears!

    @moshu:

    Ah, that’s a smart way out of things ; ) and you always seem to find your way around things ^__^; cheers to you from me =)

    Did you ever try creating one for (pages?)

    Creating what? You lost me here… 🙁

    Sorry – needs to clarify.

    I meant a Page Template for your pages – similar to the Archives idea, just that it’s for pages =).

    The so-called “Deafult Page Template” should be page.php – and it doesn’t need anything at the top (template name etc.) because WP recognizes it as the default for Pages.
    If you don’t have one, just save your index.php (from the theme!) as page.php — and edit the template tags and anything you may want (e.g. removing the category, since Pages don’t have categories, te comments call if you don’t want comments on Pages etc.).
    That’s it.

    Edit. More here: http://codex.wordpress.org/Pages

    Okay. Thanks 🙂

    One more thing.

    Does anyone know how to include a “search form” in the srg_clean_archives.php file? – I don’t really know where to put the code.

Viewing 15 replies - 1 through 15 (of 25 total)
  • The topic ‘srg_clean_archives’ is closed to new replies.