Harm10
Forum Replies Created
-
Forum: Plugins
In reply to: [Media Library Assistant] Fixed href link or caption text per id?I found the development version.
But I also found a bug in the processing of this example.
If I code this
[mla_gallery ids="961,1006,942,922" mla_fixed_title="array('Text number 1','Text number 2','Text number 3','Text number 4')" mla_link_attributes="title={+mla_fixed_title+}" mla_image_attributes="title={+mla_fixed_title+}"]
I have to specify the fixed titles with spaces in between with quotes otherwise I get nothing in my fixed values. This seems logical but the end result of the above is that only the first string gets incorporated into the element (so only showing “Text”).
I can see the values leaving correctly in $item_values array but apparently after this something goes wrong.
If I change the code to
[mla_gallery ids="961,1006,942,922" mla_fixed_title="array('Text number 1','Text number 2','Text number 3','Text number 4')" mla_link_attributes="title='{+mla_fixed_title+}'" mla_image_attributes="title='{+mla_fixed_title+}'"]
so put quotes around the placing of the fixed values everything works OK.
How come?Forum: Plugins
In reply to: [Media Library Assistant] Fixed href link or caption text per id?I know I have read somewhere how to get hold of a Development version but I cannot find that instruction any more……. So how can I get this dev.version?
Thanks for the acknowledgement. There was no need for it but still it is a nice gesture!
I was also looking at creating a translation for you (I am Dutch).
First the file you point to in the FAQ is not called MLA Internationalization Guide.php but MLA Internationalization Guide.pdf
When I follow the instructions in that pdf by opening the pot file through Poedit I do not get a language dropdown. I can probably just fill the nl code in there? But what do I fill for source code character set?
And the plurals rule should just be the default setting?Forum: Plugins
In reply to: [Media Library Assistant] Fixed href link or caption text per id?Hi!
I have updated your example to be able to set up any variable as long as the parm starts with mla_fixed_…..
Also treat a value just separated by a comma as an array.So when you code:
[mla_gallery ids="1015,1165,1074" link=file mla_fixed_caption="array('test1','test2','test3')" mla_fixed_title="'title1','title2','title3'" mla_fixed_alt="array('alttest1','alttest2','alttest3')" mla_caption="{+mla_fixed_caption+}" mla_link_attributes="title={+mla_fixed_title+}" mla_image_attributes="title={+mla_fixed_title+} alt={+mla_fixed_alt+}"]
You will get fixed values in your anchor and img title and alt and caption as well.
Perhaps you would contemplate of adding this code permanently to your plug-in?
<?php /* Plugin Name: Media Library Assistant Fixed Values Plugin URI: https://fairtradejudaica.org/media-library-assistant-a-wordpress-plugin/ Description: Adds the option to specify fixed values and use them in MLA [mla_gallery] shortcode Author: David Lingren Version: 1.00 Author URI: https://fairtradejudaica.org/our-story/staff/ Copyright 2013, 2014 David Lingren This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You can get a copy of the GNU General Public License by writing to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA */ /** * Class MLA Fixed Values hooks a few of the filters provided by the [mla_gallery] shortcode * * Call it anything you want, but give it an unlikely and hopefully unique name. Hiding everything * else inside a class means this is the only name you have to worry about. */ class MLAFixedValuesExample { /** * Initialization function, similar to __construct() */ public static function initialize() { /* * The filters are only useful for front-end posts/pages; exit if in the admin section */ if ( is_admin() ) return; /* * add_filter parameters: */ add_filter( 'mla_gallery_attributes', 'MLAFixedValuesExample::mla_gallery_attributes_filter', 10, 1 ); add_filter( 'mla_gallery_item_values', 'MLAFixedValuesExample::mla_gallery_item_values_filter', 10, 1 ); } /** * Save the shortcode attributes */ private static $shortcode_attributes = array(); /** * MLA Gallery (Display) Attributes * * This filter gives you an opportunity to record or modify the arguments passed in to the shortcode * before they are merged with the default arguments used for the gallery display. * * The $shortcode_attributes array is where you will find any of your own parameters that are coded in the * shortcode, e.g., [mla_gallery my_parameter="my value"]. */ public static function mla_gallery_attributes_filter( $shortcode_attributes ) { /* * Save the attributes for use in the later filter */ self::$shortcode_attributes = $shortcode_attributes; return $shortcode_attributes; } // mla_gallery_attributes_filter /** * MLA Gallery Item Values * * @since 1.00 * * @param array parameter_name => parameter_value pairs * * @return array updated substitution parameter name => value pairs */ public static function mla_gallery_item_values_filter( $item_values ) { /* * We use a shortcode parameter of our own to apply our filters on a gallery-by-gallery basis, * leaving other [mla_gallery] instances untouched. If the "fixed_values" parameter is not present, * we have nothing to do. Here is an example of how the custom parameter can be used: * * [mla_gallery ids="2621,2622,2623" mla_fixed_caption="array('test1','test2','test3')" mla_caption="{+mla_fixed_caption+}"] */ // Is there something that starts with mla_fixed_ ? $mla_fixed_indicator = false; foreach ( self::$shortcode_attributes as $parmkey => $parmvalue ) { if ( substr($parmkey,0,10) == 'mla_fixed_' ) { $mla_fixed_indicator = true; break; } } if ( ! $mla_fixed_indicator ) { return $item_values; // leave them unchanged } /* * Evaluate the parameter value once per page load. */ static $mla_fixed_values = NULL; if ( NULL === $mla_fixed_values ) { $mla_fixed_values = array(); foreach ( self::$shortcode_attributes as $parmkey => $parmvalue ) { if ( substr($parmkey,0,10) == 'mla_fixed_' ) { $function = @create_function('', 'return ' . self::$shortcode_attributes[$parmkey] . ';' ); if ( is_callable( $function ) ) { $mla_fixed_values[$parmkey] = $function(); } if ( ! is_array( $mla_fixed_values[$parmkey] ) ) { $mla_fixed_expl = explode(",",$parmvalue); if ( is_array( $mla_fixed_expl) ) { $mla_fixed_values[$parmkey] = $mla_fixed_expl; } else { $mla_fixed_values[$parmkey] = array(); } } } } } foreach ( $mla_fixed_values as $mla_fixed_key => $mla_fixed_value ) { /* * Apply the appropriate value to the current item. */ if ( isset( $mla_fixed_value[ $item_values['index'] - 1 ] ) ) { $item_values[$mla_fixed_key] = $mla_fixed_value[ $item_values['index'] - 1 ]; } } return $item_values; } // mla_gallery_item_values_filter } // Class MLAFixedValuesExample /* * Install the filters at an early opportunity */ add_action('init', 'MLAFixedValuesExample::initialize'); ?>
Forum: Plugins
In reply to: [Media Library Assistant] Pagination link including hash part?Although it works I think this is a somewhat complicated way to get a hash behind your paging links…….
Wouldn’t an approach like adding a new mla_output parameter for this be easier?
Something along the way of
mla_output=”hash(‘mygallery’)”
to put in the gallery shortcode itself and
mla_output=”paginate_links,prev_next,hash(‘mygallery’)”
to add to the paging gallery shortcode ?BTW I also asked in one of my other replies on resolved issues: do you have a wish list for additional features?
Forum: Plugins
In reply to: [Media Library Assistant] Pagination pages all galleries displayed on pageFirst of all I read the documentation on this parameter and did not conclude that this would the parameter to use for me in this case.
So maybe it needs some clarification?But although the gallery itself pages nicely if I click on its pager and the other one remains untouched the pager display itself isn’t.
I currently have this code:
<code> [mla_gallery post_mime_type='image' date_query="array(array('column' => 'post_date', 'year' => 2012))" post_parent=all orderby=ID order=desc posts_per_page=3 mla_debug=false mla_caption="{+post_id+}/{+post_date+}" ] </code> <code> [mla_gallery post_mime_type='image' date_query="array(array('column' => 'post_date', 'year' => 2012))" post_parent=all orderby=ID order=desc posts_per_page=3 mla_debug=false mla_caption="{+post_id+}/{+post_date+}" mla_output="paginate_links,prev_next" mla_page_parameter="mla_paginate_current_2"] </code> <hr/> <code> [mla_gallery post_mime_type='image' date_query="array(array('column' => 'post_date', 'year' => 2011))" post_parent=all orderby=ID order=desc posts_per_page=3 mla_debug=false mla_caption="{+post_id+}/{+post_date+}" ] </code> <code> [mla_gallery post_mime_type='image' date_query="array(array('column' => 'post_date', 'year' => 2011))" post_parent=all orderby=ID order=desc posts_per_page=3 mla_debug=false mla_caption="{+post_id+}/{+post_date+}" mla_output="paginate_links,prev_next" mla_page_parameter="mla_paginate_current_2"] </code> <hr/>
If I page the second gallery the pager itself shows an active link of page 2 and also the text Previous. Which is OK. But the same is displayed for the first gallery which isn’t paged. If you click on the Previous link there nothing weird happens but still it looks strange.
Rereading the documentation I tried an example with different mla_page_parameters (i.e. mla_paginate_current_2 and mla_paginate_current_3) to get a real solo paging effect for one gallery.
So I understand that the parameter name needs to be unique. That could be made clearer in the documentation.
I already read it somewhere that the myriad of possibilities of your plug-in could do with examples.
How about some examples in the documentation that only open up (with jquery) when the link is clicked? In such a case the documentation isn’t getting cluttered by all the displayed examples and if someone wants to have an explanation by looking at it (we are not all native English speakers you know….. ?? ) he/she can get it!Forum: Plugins
In reply to: [Media Library Assistant] Fixed href link or caption text per id?Thanks! This works flawlessly.
Are you considering making this approach part of the MLA plug-in itself in the future? I think it will appeal to others as well.
Or perhaps I can help coding and/or testing it?BTW Do you have some list of future enhancements?
I should have seen that myself. Especially when I look at the code block above……………… ??
Anyway it works now! Thanks for your fast response. I continue experimenting…… ??
Forum: Plugins
In reply to: [Media Library Assistant] Custom field usage?Thanks for your quick response! Indeed it works when I put custom: as a prefix.
I will investigate further what kind of logic can be built by studying the documentation further.
Thanks again!
I just found that the problem lies in the list page. If I edit either of the media files Gallery in and MLA Gallery in is correctly filled.
I was assuming that these values should be shown on the list page under the heading Inserted in but apparently they have their own columns.
After I switched them on in the screen settings everything seems to be OK.So I guess this report can set as solved.
I am setting this topic as such.
Forum: Plugins
In reply to: [Multiple Themes] Working for search page but not for others?Alright! I have now installed version 4.12 and it works fine.
Both the page and the home (and the search) give me another theme than the default theme.
So I have a working version now so I can see what it can do. And as I already expected this is entirely what I want!
As soon as your new version is ready I am quite willing to test it for you!BTW also keep in mind that URLs can also lack the www prefix.
I have not tested what happens there.Another idea: as caching can be an issue why not include a clear cache button in your plugin?
Forum: Plugins
In reply to: [Multiple Themes] Working for search page but not for others?Good that you found something! Of course I will test it when you have a fix.
Meanwhile I will give you something to think about.
My site has a domain name and an alias. I rewrite everything to use the alias. So in the end there will be 1 URL for all visitors.
Suppose someone does not rewrite? And allows visitors to use both domain name and alias separately?
The plugin does not let you enter rules for both.
I know someone (not yet running WP) that uses 1 domain and 4 aliases!
Or does WP fixes this?Forum: Plugins
In reply to: [Multiple Themes] Working for search page but not for others?I use this rewrite rule because my own “real” site needs it.
My own site is not running WordPress.
As I said this WP install is to help someone else and also to get acquainted with WP.
I will ask the one I help whether I can also experiment with this plugin on his site.Besides .htaccess editing can be very useful if you cannot access the server settings (prohibited by the provider).
Forum: Plugins
In reply to: [Multiple Themes] Working for search page but not for others?As this a testsite to give support to someone else I could switch off all plugins except this one without any problem.
The problem persists………..I do a rewrite to get the correct URL.
This is in the .htaccess file in the /sitetest/ folder:
RewriteCond %{HTTP_HOST} !^myurl$ [NC]
RewriteRule ^(.*)$ https://myurl/sitetest/$1 [R=301,L]Should I test with a previous version too?
Forum: Plugins
In reply to: [Multiple Themes] Working for search page but not for others?Sorry that does not help. I previously cleared the cache to no avail.
To be absolutely sure I used another browser with the same effect.I might add that I use an alias as my main URL.
This is also correctly shown by the plugin when it checks what I input.
But in the system settings you can see the difference in the path and URL settings.
So the URL=myurl/sitetest/wordpress/?page_id=1068
while my home path is /home/userid/domains/myotherurl/public_html/sitetest/wordpressForum: Plugins
In reply to: [Multiple Themes] Working for search page but not for others?Thanks for looking into this so quickly…..
My setting for Permalink is Default.
Perhaps you have missed it in my previous post but using the Home setting to another theme also doesn’t work for me.I also tested with Maintenance mode switched off but that didn’t change anything.
Would it be useful to test with an older version of this plugin (pre 5.0 ?).
If so where can I get those?