Forum Replies Created

Viewing 15 replies - 16 through 30 (of 33 total)
  • Forum: Plugins
    In reply to: Dynamic drop-down menu.
    muskokee

    (@muskokee)

    OK, new files uploaded! and available from webdezine wordpress menu v1.1

    Forum: Plugins
    In reply to: Dynamic drop-down menu.
    muskokee

    (@muskokee)

    Hi sfong15,

    Sorry about the errors. I have fixed them and will post the next version just as soon as bluehost gets their act together. It’s soon time to give another host my business. In my own menu I called the tables directly rather than going through wordpresses $wpdb-> , so I didn’t have a chance to debug those queries. Done now. Give about an hour before I get the new file uploaded.

    Will also amend the PHP4 version

    muskokee

    (@muskokee)

    That’s fabulous! I was just sending a message through to fix the global $posts; to global $post; . I’m glad it’s sorted out ??

    muskokee

    (@muskokee)

    Is the query in a function? If it is have you called $posts through global?

    What plugin is it?

    EDIT: Silly me, I should have reread the above posts. Yup, it is a function. Check to make sure that right after the function name is

    global $posts;

    muskokee

    (@muskokee)

    how about if you load the post title into a variable first, then use the variable in the query?

    $posted = $post->post_title;

    muskokee

    (@muskokee)

    Try this:

    $query = sprintf("SELECT * FROM %s WHERE title='". $post->post_title ."' LIMIT 1");

    muskokee

    (@muskokee)

    I’m back with a tested method – and no additional queries needed – the info is coming from the category cache.

    This has been tested and it works – no errors.

    In your theme/***/index.php page find:
    <?php while (have_posts()) : the_post(); ?>

    directly after that place this:

    <?php
      $the_cat = get_the_category();
      foreach ($the_cat as $uh_huh){
      if ($uh_huh->cat_ID == 13){
      echo 'Yuppers';
      }else{
      echo 'Nopers';
      }
      ?>

    This is just a demo code. You would change the category id 13 to whatever category you want to display posts for, as well as putting whatever you want on the “Yuppers” line.

    Just plug this in and test it to make sure it works for you. It should display one of the two echos depending on the category id of the post.

    If you need any more info or whatever, reach me here or over at my blog .

    Best, Sheri

    muskokee

    (@muskokee)

    Sorry, that was untested and just an idea to try. It produced unexpected results when I tried it. Give me a bit of time and I’ll have something for you.

    muskokee

    (@muskokee)

    I find adding this code to my main page helps me to see what information I have to work with that is already available:

    <?php print_r ($wp_query); ?>

    Once you see the results of that print, you will see that there is absolutely no mention of a category on the front page. Argh. You’ll have to query the database with
    something like:

    $one_cat_post = $wpdb->get_results('select post_id from $wpdb->post2cat where category_id =\"the category number you want\"', ARRAY_N);

    Then on the main page after:
    <?php while (have_posts()) : the_post(); ?>

    load up a variable with the current post id:
    <?php $curr_ID = the_ID();?>

    use a conditional statement to select the posts you want to display

    <?php if ( (isset($one_cat_post)) && (in_array($curr_ID,$one_cat_post)) ){
    
    enclose all the regular front page info in here
    
    }?>
     

    EDIT: there should not be backslashes where you insert your own category id in the sql statement. The editor keeps putting them in

    Forum: Plugins
    In reply to: Dynamic drop-down menu.
    muskokee

    (@muskokee)

    Sure. I understand about modification frustrations. They just have to be sorted out!

    Forum: Plugins
    In reply to: Dynamic drop-down menu.
    muskokee

    (@muskokee)

    Hi sfong15,
    Please go ahead, take the menu and test away. The menu code is pretty straight forward. Let me know how it turns out.

    Forum: Plugins
    In reply to: Dynamic drop-down menu.
    muskokee

    (@muskokee)

    Did you add a link to the css? I didn’t put that in the read_me file –oops
    are you adding the require statement to the header.php in the theme dir?

    Forum: Plugins
    In reply to: Dynamic drop-down menu.
    muskokee

    (@muskokee)

    Yup, WP is not the most complicated code.
    I changed the query results to arrays rather than leave them as objects, so all should be good to go for PHP4. Since I’m on 5 I can’t verify that the menu works (can’t see why not!). If someone on PHP4 could test it that would be great. The link to the menu is the same as the last one. Just scroll to the bottom for the additional download

    Forum: Plugins
    In reply to: Dynamic drop-down menu.
    muskokee

    (@muskokee)

    Well, if there is a need for it, I can rewrite it for under php5. But…PHP5 is really the safest version ?? I need a tester

    Not sure what you mean by this:

    I’m new to WP but it looks flexible enough to add code snippets to the theme. google, get, enjoy.

    Forum: Plugins
    In reply to: Dynamic drop-down menu.

    Thank you sfong15!

Viewing 15 replies - 16 through 30 (of 33 total)