nudnik
Forum Replies Created
-
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.
Forum: Developing with WordPress
In reply to: WP hacks; customize output with query_postsCheck the code in the query.php page in INCLUDES. I think it parses the query_posts value, so “orderby=zapscore” won’t work.
Forum: Fixing WordPress
In reply to: WP Search Mocks Me. Returning No Results.If you’re expecting certain posts to show up and they don’t, you may need the “search-everything” plugin.
Forum: Developing with WordPress
In reply to: Using conditionals with custom fieldsLook 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.
Forum: Themes and Templates
In reply to: Changes For Header?Seems to be a CSS issue more than a WordPress issue.
Forum: Developing with WordPress
In reply to: code to pull uploaded photo into css backgroundYes, 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>"; }
Forum: Developing with WordPress
In reply to: Multiple presentations of usernameThis 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.
Forum: Developing with WordPress
In reply to: Query posts by category OR pageI’m not totally following, but it looks like you want it to be OR page_id=2, not AND page_id=2.
Forum: Developing with WordPress
In reply to: Template tags and menusI’d manually add the pages, personally. Looks like the function definitions are pretty complex for the page listing.
Forum: Developing with WordPress
In reply to: Link post together with custom metadataI’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!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/f552e07aeForum: Fixing WordPress
In reply to: WordPress Issue: Too many Mysql QueriesNearlyFreeSpeech.net will give you your own MySQL process. Cheaper than a dedicated server.