8900200
Forum Replies Created
-
Forum: Plugins
In reply to: [Media Grid] Bring back Select/edit/deleteHello all – I was looking for such a tool as well. Curious, do some of these tools simply delete from the uploads folder, or are they savvy enough to remove database references to the images. I just assumed that the DB gets a media table record to track the media.
aside: when we look at the unattached images bulk select option… are these simple ones that have no inserted (posts, page, etc) records? I’d be happy to simply use this to select all unattached items and then delete those, but I’m that my custom theme(has custom data types e.g. “portfolio” ) may have items attached that WP can’t detect. Is this a valid guess?
Thanks in advance! ??
Rich
figured it out
Ok, thanks. But they don’t error unless your plugin is activated?
Hey. It’s all good. I do appreciate your time and help.
I tried to mention that I was using a plugin that literally created a loop through a set of posts based on category… or in this case custom taxonomies. It’s also in my code. I get that I may be looking at this in a different way than many people do, but as is par for the course with wordpress there are times when the status quo isn’t helping the developer. This is one of them. Just note the many posts on the net related to dealing with these issues. And your concerns about server load times. The bottom line for me is how hard it is to determine a primary category, in a sense, and them what to do with the other ones. In the end I made sure they all only had one and now I’m good.
Sure, you could say that I need to get closer to the functions and understand how they are built a little better. I did look at those functions closely. But my point is that the func reference doesn’t say anything about how it deals with multiple results (that I saw). BTW – that array(2) that you mentioned. I had two calls going one after the other the same dump but with different categories being called at one point and frankly didn’t see the second dimension.
Best
RichNo offense taken. I’ve been researching a lot though. Just take a look at this for example…https://www.studiograsshopper.ch/code-snippets/category-description-with-multiple-categories-and-get_the_category/
Also, you are pulling taxonomies by a post ID. It doesn’t matter if some are something and others are something else. You are only dealing with one at a time.
You are assuming a lot too. This comment indicates that. If you read it and understood that the use of the IDs is to reference other posts by creating previous and next links to them you’d “get” that there is a problem.
Well, if some posts are assigned to 3 categories and some are only in 1 then functions such as wp_get_object_terms( I believe) only return the first category they find. I’ve seen a few caveats next to functions like this and plugins that say that they don’t play well when posts are assigned to multiple categories.
In this case, I had a problem with using the first category provided by the terms function since I wanted to use the ID to look for all other posts in the category. The problem happens when I get to a sibling posts that also have another cat assigned, and that one comes up first from these functions. As soon as the user gets to one of those posts the prev-next code grabs its ID and start creating prev-next links outside of the original cat that they landed on. Clear as mud? ?? I could look for ways to hard code things, but I’d rather have it done pragmatically.
Ah, now I’ve hit the dreaded multiple category assignment issue. Wonder how I can a list of all the categories a post belongs too….
Wait. Got it.
portfolio-category, not categories! They had an internal name diff from the UI… of course ??
array(2) { [0]=> object(stdClass)#66 (9) { [“term_id”]=> string(3) “114” [“name”]=> string(20) “Home – Visual Design” [“slug”]=> string(18) “home-visual-design” [“term_group”]=> string(1) “0” [“term_taxonomy_id”]=> string(3) “132” [“taxonomy”]=> string(18) “portfolio-category” [“description”]=> string(0) “” [“parent”]=> string(3) “115” [“count”]=> string(1) “2” } [1]=> object(stdClass)#65 (9) { [“term_id”]=> string(1) “3” [“name”]=> string(13) “Visual Design” [“slug”]=> string(13) “visual-design” [“term_group”]=> string(1) “0” [“term_taxonomy_id”]=> string(3) “110” [“taxonomy”]=> string(18) “portfolio-category” [“description”]=> string(0) “” [“parent”]=> string(3) “105” [“count”]=> string(1) “6” } }
Thanks. Hmmm. The plot thickens.
I added
var_dump(wp_get_object_terms($post->ID,'portfolio')); var_dump(wp_get_object_terms($post->ID, 'portfolio-categories'));
and now I’m getting:
object(WP_Error)#160 (2) { [“errors”]=> array(1) { [“invalid_taxonomy”]…
keesiemeijer – it’s in a template named single-portfolio.php.
Here you go. I think I’ve set the bin up correctly.
Thanks. Say, here a screen grab for the Portfolio Post type I am seeing and the category.
https://www.dropbox.com/s/rh5zykbr1f9co8n/ScreenClip%20%5B16%5D.png
I’m starting to wonder if I can attack this in another way. I’ve got my intra category nav setup and ready using “previous_post_link_plus” plugin. In fact when I set that up to use a single category id (30) it appears to be serving up only prev/next links from the specified cat.
Yeah, it is. And with your code I’m getting nothing. Maybe it’s the way this Theme setup their custom posts…
array(0) { }
Hmmm. Many of the standard functions claim that they don’t work with custom post types. If this one does then a simple test should work, right?
$post_categories = wp_get_post_categories( $post->ID );
echo “test: ” . $post_categories[0];I’m getting nothing. What test are you doing?
Thanks
RichDoesn’t work for custom post types…
No, the category ID for a custom post data type.
Thanks