Corey Worrell
Forum Replies Created
-
Forum: Plugins
In reply to: [Advanced Custom Fields: Link] Return emptyIGNORE
- This reply was modified 8 years, 1 month ago by Corey Worrell. Reason: wp.org double post
Forum: Plugins
In reply to: [Advanced Custom Fields: Link] Return emptyForum: Plugins
In reply to: [Advanced Custom Fields: Link] Looks oddThank you for that. I agree that does look nice. I’m not sure if it is better though to have the extra line breaks using more space on screen, versus a more compact style. But I will do some tests and try to incorporate it.
Forum: Plugins
In reply to: [Advanced Custom Fields: Link] Can't be used on an Options pageYes that is very weird. Sounds like something is up with the update checker on your install. Manually updating from the wp.org plugin page and uploading new version should fix the options page issue though.
Forum: Plugins
In reply to: [Advanced Custom Fields: Link] Looks oddHi @nicmare,
Could you please try installing a patched version: https://dev.emrl.mx/acf-link.zip
Or you can manually remove line 6 (position: relative) from the
/acf-link/css/input.css
file.Let me know if that fixes the issue. Thank you.
Forum: Plugins
In reply to: [Advanced Custom Fields: Link] Can't be used on an Options pageHi, have you updated to latest version (1.1.4)? I am testing with WP 4.6.1-alpha and it is working on option pages. Is there possibly another plugin generating a JavaScript error and causing the link field to not work either?
Forum: Plugins
In reply to: [Advanced Custom Fields: Link] Link opens in new tab regardless of selectionHello @pma4life,
The field is saved in the database as either a “0” (same window/tab) or “1” (new window/tab), and it is the developers responsibility to use that how they see fit. For example:
<?php $link = get_field('link'); $target = $link['target'] ? ' target="_blank"' : ''; $a = sprintf('<a href="%s"%s>Link</a>', $link['url'], $target);
Or you could always add a filter to format the target how you like. Example:
add_filter('acf/format_value/type=link', function ($value, $post_id, $field) { $value['target'] = $value['target'] ? '_blank' : '_self'; return $value; }, 10, 3); $link = get_field('link'); printf('<a href="%s" target="%s">%s</a>', $link['url'], $link['target'], $link['title']);
Forum: Plugins
In reply to: [Advanced Custom Fields: Link] Looks oddThank you. That field looks very narrow, I’m not sure if other ACF fields would fit in there either.
But I will try to create a style for narrow fields.
Forum: Plugins
In reply to: [Advanced Custom Fields: Link] Does the array also contains post_id?Marking as resolved
Forum: Plugins
In reply to: [Advanced Custom Fields: Link] Does the array also contains post_id?Hi @nicmare,
The native WP picker does not expose the post ID in this instance, so it is not stored in the array.
If you’d rather have the ID it might be better to use the Post Object field instead, and have a field to select internal/external link type, and then show the corresponding field (post object or url).
Or if you’d rather keep using the Link field, you can add a filter via
acf/format_value/type=link
where you could possibly check the hostname of the value to test if if is an internal link, and then split the value to get just the pathname (ie: /page-name/) and then useget_page_by_path
to get the ID (can be used with all post types as seen on documentation page linked above).I have released a new version with this implemented. If the title field is empty, it will populate it with the selected page (as native WP does).
Thank you!
Thank you. Will try to include in next release, in about 2 weeks from now.
Forum: Plugins
In reply to: [Advanced Custom Fields: Link] Parse error when trying to activate the pluginYou must have PHP 5.4 or greater.
Forum: Plugins
In reply to: [Advanced Custom Fields: Link] Losing selection when editingGreat. You could always add a filter to format the target how you like. Example:
add_filter('acf/format_value/type=link', function ($value, $post_id, $field) { $value['target'] = $value['target'] ? '_blank' : '_self'; return $value; }, 10, 3); $link = get_field('link'); printf('<a href="%s" target="%s">%s</a>', $link['url'], $link['target'], $link['title']);
I’ve released a new version (1.1.3) with the previous fixes for the edit functionality.
Thank you for your help and patience.
Forum: Plugins
In reply to: [Advanced Custom Fields: Link] Losing selection when editingwww.ads-software.com double posted.