Forum Replies Created

Viewing 13 replies - 1 through 13 (of 13 total)
  • Hmm.. if only the permalinks were touched… could it just be that you did a chmod 777 to your .htaccess and somebody modified it?

    I’ve created a plugin to solve this problem for now: https://janit.iki.fi/temp/page_slug_checkr.phps

    I suppose you could have a permissions problem with your .htaccess file. I’ve had that problem and I think WP didn’t even give me an error when it happened. So do an appropriate chmod on your .htaccess.

    Thread Starter Jani Tarvainen

    (@janit)

    Atleast static rewrite performance improved significantly when the rewrite rules were moved from .htaccess to Apache config. When 1.6 and the new rules come around it can be done this way for real ??

    https://janit.iki.fi/wp-bench/#res5

    Forum: Plugins
    In reply to: File Attachment for Entries

    tripodmsu I’ll give your plugin a try. thanks!

    Hmm… I don’t get your point of square syndrome, but could it be a character encoding problem?

    wp_list_pages (and list_cats) are otherwise good for creating navigation, but there’s one thing I’m missing. See binary bonsai, for example: https://binarybonsai.com/wordpress/k2/bugs/ . The pages are nicely folded out, but there’s no indication in the (X)HTML that you’re in wordpress/k2/… The functions only add the selected class to the page you’re in ??

    Forum: Plugins
    In reply to: File Attachment for Entries

    It’d definitely be useful… I even think I’ve seen it being done somewhere (with WP), but can’t remember… stupid head!

    Thread Starter Jani Tarvainen

    (@janit)

    Sure ?? Most of the template translations are hardcoded ( <h1>Hello</h1> vs. <h1><? echo $greeting ?></h1>”, for example ), for these I’ll have to create my own dictionary solution.

    Here’s an example with the following structure (it gives me localized dates and navigation):

    / – finnish
    /en/ – english

    Some translations come from the language files (/wp-includes/languages/xx_xx.mo). I’ve got the necessary ones in place and I add this:


    $URI = explode('/',$_SERVER[REQUEST_URI]);

    if (in_array('en',$URI)){
    define ('WPLANG', '');
    } else {
    define ('WPLANG', 'fi_FI');
    }

    It breaks the request to an array and defines the appropriate language file. Now I get localized dates (not sure if anything else even comes from the file).

    I can also use the same trick to build the navigation (english page, english links only, etc.). Remember my ‘root language’ here is Finnish. I’ve got something like this in my template header.php


    $URI = explode('/',$_SERVER[REQUEST_URI]);

    if (in_array('en',$URI)){
    $catOptions = 'child_of=2';
    $pageOptions = 'title_li=&child_of=2';
    } else {
    $catOptions = 'exclude=2';
    $pageOptions = 'exclude=2';
    }

    English category and root page are both ID 2, your mileage may vary. I then later create call the wp_list_cats and wp_list_pages with the appropriate variables to create a navigation. You’ll need to have the english link (/en/) somewhere, since its not displayed in the page navigation.

    The structure is now like this:
    / (english front page)
    /finnish-page/
    /category/somecategory/post1
    /en/ (english front page)
    /en/english-page/
    /category/englishcategory/post1
    …..

    I’m in a hurry and might have missed something. Hope this clears it up.

    Thread Starter Jani Tarvainen

    (@janit)

    Problem solved. Just used some if statements in wp-config to hack the correct language file according to URI.

    Thread Starter Jani Tarvainen

    (@janit)

    I worked on it a bit. Still missing stuff, but you can now test it if you wish: https://janit.iki.fi/temp/plugin_pagetree.phps

    This plugin gives you two functions: buildPagetree() and writeFirstLevelNavi(). The following code will give you your pages in a hierarcical array:

    ‘<pre><?php print_r(buildPagetree()); ></pre>’

    The first plugin is not that useful because the pagetree is still missing the “active” property to give you the option for setting your links as active and providing folding levels, etc. but I have it working on the first version (which is at the office).

    Another problem with the approach could be problems with performance… This creates a bunch of extra queries on your database. It could be optimized to only fetch subcategories of the active level… And with a cache in place the overhead is less a problem.

    Let me know if you find this useful.

    Thread Starter Jani Tarvainen

    (@janit)

    Thanks for your replies. So it seems I’ll have to go with some custom stuff. I’d like to make it (at least partly) automatic, so maybe I’ll just try to improve the navigation function I already built. I suppose it’d be easy to build it as a plugin. If I manage to build it elegantly then I could give back something to the WP community ?? Here’s what I have in mind (and crudely done, but the code is at work):

    EDIT: Moved to external file for better readability: https://janit.iki.fi/temp/pagetree.phps

    One would then build the pagetree in the header <? $pagetree=$buildPageTree(); ?> and write the first level (horizontal) navigation where they’d like it: <? writeFirstNavilevel($pagetree); ?>. I’ve also got a recursive function for building up the left level navigation with automatic indentation.

    This still leaves open the issue of loading up categories, but I can do that by manually inserting them to the $pagetree after it has been generated.

    I’m also missing the ‘ class=”selected” ‘ -functionality for list_pages()… Any news on this one?

Viewing 13 replies - 1 through 13 (of 13 total)