Forum Replies Created

Viewing 13 replies - 1 through 13 (of 13 total)
  • Forum: Plugins
    In reply to: Only use first tag?

    If you can organize the tags by importance, you can write a php script that will loop through the tag list and pull the one that’s most “important”. So if the most important tag is “news,” any post marked “news” will have that displayed. Otherwise, it will display the next-most important.

    Forum: Plugins
    In reply to: Only use first tag?

    There is no data in the database that stores the order the tags were entered in.

    Check the code in the query.php page in INCLUDES. I think it parses the query_posts value, so “orderby=zapscore” won’t work.

    If you’re expecting certain posts to show up and they don’t, you may need the “search-everything” plugin.

    Look at the code in the search-everything plugin. I think you’d need to write a custom SELECT query using whatever join it says for searching metadata, and check WHERE [certain custom field] != ”.

    The dirtier (but easier way) would be to have a query that selects the maximum number of recent posts that might not have that custom field set (i.e. 10), then loop through them. When you find one with the custom field set, then display that post and break out of the foreach.

    The latter could very easily break, though, and puts an unnecessary load on the database.

    Seems to be a CSS issue more than a WordPress issue.

    Yes, doable.

    $temp_meta = get_post_custom();
    $meta_img = $temp_meta["postname-image"][0];

    Then

    echo "<div class=\"genericphotostyle\" style=\"background-image:url({$meta_img})\"</div>";

    etc.

    To do multiple images, you’d obviously need multiple divs. You might want to run a PHP loop
    if (!empty($temp_meta["postname-image2"][0])) { echo "<div></div>"; }

    This seems to be normal behavior. The dropdown shows first the currently selected name, then the login name, then the “nicename”, then the first & last name (or something along those lines).

    Change the nicename and it will show up in the list.

    I’m not totally following, but it looks like you want it to be OR page_id=2, not AND page_id=2.

    I’d manually add the pages, personally. Looks like the function definitions are pretty complex for the page listing.

    I’d add some hidden posts (category = metadata, hide all metadata posts on displayed pages).

    To display the info, you’ll SELECT the metadata WHERE post_title = distillery name AND category = metadata.

    It’s a hack, but then again so is anything else.

    You could alternatively create pages with that info, and they’ll just be private (hidden) pages. You can select by name and pull whatever info you want. Just be sure that you exclude these pages from any page listings.

    OR, if you’re the only one posting (or you don’t display user info anyhow), make a “user” called the distillery name, and enter the distillery info into the user boxes. (This can be confusing unless you’re willing to hack the core.) I.e. “nicename” = displayed distillery name. “url” = website of distillery (if available) etc.

    Forum: Plugins
    In reply to: Help with SQL syntax!
    Thread Starter nudnik

    (@nudnik)

    OK, after breaking my head on it for hours on end, I got the search functionality I wanted.

    First I search for matching tag slugs, and then use the following syntax:

    SELECT ID FROM db_posts LEFT JOIN db_term_relationships ON ID = db_term_relationships.object_id
      WHERE ((term_taxonomy_id = 233) OR (term_taxonomy_id = 140) OR (post_title LIKE '%hawaii%'))
      AND ID IN
    (SELECT ID FROM db_posts LEFT JOIN db_term_relationships ON ID = db_term_relationships.object_id
    WHERE ((term_taxonomy_id = 48) OR (term_taxonomy_id = 233) OR (post_title LIKE '%vacation%')))

    Note that I don’t need it to search post content, so it doesn’t! It does, however, match both single and multi-word tags (searching for “new york times” will match the “new-york-times” slug, as well as “new-york” and “good-times”.

    In case it will help anyone else, here is the complicated PHP markup (I think it breaks standard functionality of the plugin FYI):
    https://wordpress.pastebin.com/f552e07ae

    NearlyFreeSpeech.net will give you your own MySQL process. Cheaper than a dedicated server.

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