diesel33
Forum Replies Created
-
This issue has been solved after some tricky procedures.
From my side as an user, as a ‘topic creator’, I need to show here my gratitude for the efforts taken towards the solution I had on mind since the very beggining.David is not only a good example of open source code developing and shared computer solutions, but a better example of great infinite support and non profit giving.
Thanks for your examples, of code and of being.
Good ideas and good explanation.
I got the att_category point!Sent you an email in the contact-us page. Please check it and … let’s switch to emails!
Thanks
Hi David,
Thanks again for your efforts.1. My library items are always attached to posts while I write. Not pages. But there’s the possibility that I uploaded items in a wrong post as I explained. Also some items have no parent and I don’t know why.
2. I wanna focus in category for this issue. Tags are quite random. The posts are always created with some categories and some tags, normally more than one. I wanna get the parent post category to the pictures that were inserted in that post, basically.
In the shortcode I use the category taxonomy, not the att_category or any other, so it is the category field which should be updated or filled.3. I guess stick to post categories… ??
I wanna recall the original purpose, cause I am a little bit lost now and don’t know how to proceed next. It was just to assign right parents to those library items that got wrong parents (‘attached to’ values), probably because I did upload them all in same moment, I.e. in same post even if they belong to other story/post.
Also assign parents to the orphans.
After right assignments, second task is to SYNC these items with parents categories. This way mla will show right filtering in drop down and shortcode.1. Is your code using the existing inserted-in values to update the parent value? Or is it actually going in the post body and looking for < img > HTML tags of images and getting the post categories to them?
2. VERY IMPORTANT: I noticed something is wrong in the blog now. The sidebar categories links show inappropriate count numbers on the categories that have been synced already, in this case ‘inéditas’ or ‘india’ for example.
It is counting way too many more than real. This seems to be counting now not only posts under category but also library items … or that is what I deduced. This is abnormal and should be corrected immediately! Please show me if I can correct it on code so it only counts posts and gets back to normal!Could you let me know what next steps would be necessary to fulfill the above stated purpose with the plug in? Do I need some UPDATES to see the changes? Will I need to smc sync-all button after all?
Sorry and thanks a lot David.
Hey David.
Those plugins were “Insert PHP Code Snippet” and “Insert PHP”, both simple and not too updated, so making them suitable for my old version of WP. You can add snippets in the first, then calling them with a specific shortcode in post/page, or just use php special tags around your php code in the second.
I used some logic to get $_POST or $_GET param and show the text.
So this “MLA Insert Fixit” will work, if you add option, on all attached and unattached items of media library, therefore updating all items that are already wrongly attached to a parent post, to the post where the item (picture) is first found inserted in the post body? As an < i m g s r c = “” / > tag I guess?
And similar for featured?This could be nice to do before I click on the smart-media-categories sync-all-items button. That way the parents would be correctly assigned to media pictures, and therefore convenient terms would be inherited.
That “Copy Parent values to attached Media Library items” sounds exactly like what we want, like the button I just mentioned, the ‘sync-all-items’ on the smart-media-categories example plugin.
Why do you first say it is not what I want? If it is not developed yet, as your next paragraph indicates, and if it would be better than the sync-all, then it definitely would be of interest!!Thanks again David!!
Hey David;
All good news;
Your code works as expected.
I decided now tags are not efficient filtering cause parent of a tag has also other absolutely different tags and pictures end up mixing ‘sunrises’ with ‘adventure’ for example.So I put all in same page (https://www.yomelargo.com/galeria/) and initially shows all pictures, then filters per category if selected. I think it is going well.
I had to install little plugin for executing php snippet code on post/page body so I could echo the current_cat param wheter coming thru POST or GET, if informed. This was tricky because it didnt allow special chars to be submitted and updating page with shortcodes failed always. So I went to the raw WP database and put the php code there as snippet and after a few trials (unicode neither allowed to put single quotes ‘) I got it working, you can check online.
I am super grateful for all your help and time involved.
Let me know if you see any way with my first question, and otherwise I’ll sync all media items with parent terms with the button on MLA assistant page.
?? ?? ??
David, I am grateful for the time you take to specifically reply all our questions. Your willing to code custom plugins for specific user requirements is so generous ??
1.- I believe I have never used the same picture in two posts or pages. So there would be no issue with deciding which ‘insert’ would be more imperative. The where-used fields like inserted-in give me, indeed, tips for manually re-assigning parents to wrong childrens. But it is not always the same that’s informed. It varies from children to children, sometimes it is featured-in, sometimes gallery-in…
Between your two approaches, I believe the first is more ideal.
I think I am not in shape for coding a plugin and I don’t wanna make you work too much in this. In the end, it is literally too expensive to go thru all my media library assigning right parents or categories but it would anyway be my job ??
Please proceed with coding only if it is an easy thing and challenges you.2.- The &.
Something tricky. It changes even the order of parameters depending on how I write it. My code is:<form id="mla-text-form" action="." method="post" class="row"> <strong>Categoría:</strong> [mla_term_list taxonomy=category mla_output=dropdown mla_markup=cat-dropdown mla_option_value="{+slug+}" show_count=true] </form> [mla_gallery category="{+template:{+request:current_cat+}+}" posts_per_page=12 post_mime_type=image/jpeg mla_output="paginate_links,show_all" mla_link_href="?mla_paginate_current={+new_page+}¤t_cat={+request:current_cat+}"] [mla_gallery category="{+template:{+request:current_cat+}+}" posts_per_page=12 post_mime_type=image/jpeg link=file mla_itemwidth="172px !important" mla_margin="20px 10px" mla_caption="{+caption+}" mla_rollover_text="{+title+}"] [mla_gallery category="{+template:{+request:current_cat+}+}" posts_per_page=12 post_mime_type=image/jpeg mla_output="paginate_links,prev_next" mla_link_href="?mla_paginate_current={+new_page+}¤t_cat={+request:current_cat+}"]
Note that I have cat-dropdown dropdown declared in the settings page with submit ‘onChange’ and current_cat as parameter field between navigations.
Note that I have two pagination outputs, above and below, for easier navigation. One shows all pages, another prev_next links.The first pagination (with & a m p ; even if code above shows same) makes the pages url like:
?amp;current_cat=india&mla_paginate_current=2The second (using only a plain ampersand like your examples) like:
?mla_paginate_current=2#038;current_cat=indiaI always use text window and not visual wondow for editing posts.
3.- NOTE: the only thing I’ve changed from your code is the template part.
You separate with a | the second part, ‘bad_term’, for displaying gallery empty if no dropdown item selected. I wanted to show all items with no filter when page is first displayed and no category is selected, so I tried ‘all’ after the | and then I just deleted it with it’s corresponding brackets. It ends like:
category="{+template:{+request:current_cat+}+}"
and still it is empty on first display.Could you tell me how to show whole gallery on first display (like with post_parent=all but within this example)?
And more important, can you tell me if this code change I’ve done could be responsible of the ampersand thing? ??I don’t believe so: everything works great but the pagination urls, as described above.
4.- Finally, I wonder if I can display anywhere on page, outside mla shortcodes, the name of the category that has been selected, as improval for UX, user experience. Otherwise user sees pictures but nowhere says what pictures are, even the dropdown is reset to initial value.
See it all in
https://www.yomelargo.com/galeria/categorias/Thanks mate!
I have a little extra question now:
When declaring the navigation links for pagination, it is necessary to pass by url params the number of page and the current category; As you know url params are separated by ampersand symbol &.
In the shortcode, ampersand is not recognized and pagination links are messed.
mla_link_href='{+new_url+}?mla_paginate_current={+new_page+} -> & <- current_item={+query:category,text+}'
Link generated is like:
?mla_paginate_current=2#038;current_item=everestHow to write that ampersand so it doesn’t mess? I tried & and also & #038; but it messes still more ??
I wonder if any of the options in this page will help:
https://www.toptal.com/designers/htmlarrows/punctuation/ampersand/By the way, in the code above, can not current_item parameter be also
{+request:current_item+}
instead of
{+query:category,text+}
?Thanks for your time !!
David,
Good news about installing; easily I installed both plugins thru ftp and activated them.I tried the first approach (with mla-substitution-parameter-hooks-example) but I got a little bit lost in the IPTC/EXIF tab with rules and templates so I went for the easy,
The second example plugin (smart-media-categories) was, as for the user from the original topic, easy to work. I read thru the pdf with instructions and got a few posts individually synced with their attachments.
Things should go smooth now, no reason to not click on the challenging ‘Sync all children’ button, but one thing;
I’ve noticed that the system finds children attachments of posts by their parent ID, this seems to be the post they were “uploaded to” (as in the original media library ‘All’) or “attached to” (as it says in your Media Library Assistant).
I understand this association is made when you upload new files when writing a post -or page-, i.e. from the ‘Add new’ page (for posts in this scenario).I regret I have quite often uploaded bunches of pictures at the same time when redacting the same post, even if they would end up being INSERTED in different posts, just to batch the whole thing while I wrote.
This means many of my pictures are ATTACHED to a post (children of it) now in wrong posts, and if I SYNC all, some pictures would end up with taxonomy categories they don’t belong to.
Just correct me if I am wrong.
Also I wonder if there’s a way to use those fields (Featured in,Inserted in,Gallery in), cause, as you can imagine, the 100% accurate solution in my project would be to give children only the parent’s categories where they were INSERTED, meaning, where they were linked, on the post body, with an html tag.
Many times the attachments (images, children) are unattached, they have no parent, I wonder if I uploaded them from the main gallery page and not from a post. In those cases, the fields Featured in,Inserted in,Gallery in, are informed and could be super useful.
Let mew know your thoughts, and always grateful!
Hi David,
thanks for your rapid reply, it is awesome to see there’s already a workaround for it and motivation is back!The first issue I have is that I can’t install any of the example plugins suggested in that topic, cause when I click on the ‘Example plugins button’, it lands on the page only saying that typical error message of WP,
‘Are you sure you wanna do this?’
‘Try again’The url is
wp-admin/options-general.php?page=mla-settings-menu-documentation&mla_tab=documentation&mla-example-search=Search&_wpnonce=438845bb87This could be because my version of WP is old and I don’t upgrade it because I have made a lot of changes in native code thru the years and everything would be messy without them.
I hope there’s another way to install those? ??
Maybe uploading the files of plugings thru ftp?
Is there a way to find a zip or something like with raw plugins?The plugin examples are
MLA Substitution Parameter Hooks Example
and
Smart Media CategoriesThanks so much David.
By the way, the purpose is to use on a form
mla_term_list
to show the WP categories (and probably do the same with tags) on a dropdown and then click to filter on same page or another. So the slug of the category/tag should be received on target page and use mla_gallery shortcode with it…
pretty much like in the example of documentation.Cheers!