Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter wp3678

    (@wp3678)

    wp_list_pages isn’t a filter. It’s a function/template tag.

    No it is a filter see the Filter Reference page.

    http://codex.ww.wp.xz.cn/Plugin_API/Filter_Reference

    Basically the problem is there is a filter for pages, a filter for categories but there is NO filter for archives which seems very strange.

    I am suggesting could one be added or is there a workaround?

    Thread Starter wp3678

    (@wp3678)

    No that does not seem to work

    add_filter(“wp_get_archives”,”testme”);

    The function testme does not appear to be executed?

    add_filter(“wp_list_archives”,”testme”) does not work also.

    Any other ideas?

    TIA

    Thread Starter wp3678

    (@wp3678)

    Probably many ways of doing this but the PHP explode() function does the job (converts a string to array).

    `$args = array(
    ‘numberposts’ => 5,
    ‘category__and’ => explode(“,”,”1,2″);
    );
    $theposts = get_posts($args);`

    Thread Starter wp3678

    (@wp3678)

    Simple when you know how wp_specialchars_decode

    Thread Starter wp3678

    (@wp3678)

    Many thanks that does work in isolation but I think my problem is actually with trying to parametrize the 1,2 bit.

    In the get_posts example it uses examples like:

    $myposts = get_posts('numberposts=5&offset=1&category=1');

    This means the 5, 1, 1 in the criteria string can easily be built up into to appropriate string to be sent into get_posts.

    Can the category__and option be made to work like that or do I need to do something else to build up a string?

    The following (obviously?) do not work for me is what I need possible?

    $myposts = get_posts('category_and=1,2');
    $myposts = get_posts('category_and=array(1,2)');
    $myposts = get_posts('category_and=>array(1,2)');

    TIA

    Thread Starter wp3678

    (@wp3678)

    Answering my own question again but the following URL has an example on how to detect page http://ww.wp.xz.cn/support/topic/125439?replies=9

    Thread Starter wp3678

    (@wp3678)

    Got this virtually sorted now.

    Does anyone know how to limit the execution of some code to a specific page? e.g. if pageid=1 then dothis1 elseif pageid=2 then dothis2 else dothis3.

    The original code snippet by jbrndt is missing the following line at the end.

    <?php $wp_query = $temp_query; ?>

    Thanks

    Thread Starter wp3678

    (@wp3678)

    I have inserted the below code in my existing page.php just after the <?php the content…..> line. I am using the Default theme (WordPress v2.5.1)

    This half works as a list of the posts from the category are output but then the full text of the first post in the list is output and then a full list of the posts from the category again repeated until the browser hangs/slows and you need to press the stop button.

    Can anyone help further and tell me how to fix the problem?

    Thanks

    <?php query_posts('category_name=mycatname&showposts=109'); ?>
    <?php while (have_posts()) : the_post(); ?>
    <div class="post" id="post-<?php the_ID(); ?>">
    <ul><li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></li></ul>
    <?php endwhile; ?>
Viewing 8 replies - 1 through 8 (of 8 total)