• (I went to Github so post the issue there, but saw completely different version numbers, and got a little bit confused, so posting it here)

    Here:

    if ( isset($item['social-target']) && !empty($item['social-target']) )
       { $target = 'target="' .$item['social-target']. '"'; } else $target = '';

    The $item[‘social-target’] is an array. PHP prints a “conversion” warning.

    $item['social-target'][0] works fine, but all this looks strange.

    (Version: 1.5.4 from www.ads-software.com)

    Thank you!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi TIV.NET INC. Where are you seeing the “conversion” warning? The variable $item is an associative array; ‘social-target’ is a key in the array. It doesn’t require a numeric index.

    Thread Starter TIV.NET INC.

    (@tivnetinc)

    Thanks for the screenshots. Can you post a link to your site? Also, a screenshot of social link options you have defined? Thanks.

    Thread Starter TIV.NET INC.

    (@tivnetinc)

    Hi again,

    The site is not live yet.

    If you look at the Option Tree code, you’ll notice that checkboxes are arrays.

    In wp-content/themes/hueman/functions/theme-options.php line 918:

    array(
    	'id'		=> 'social-target',
    	'label'		=> 'Link Options',
    	'desc'		=> '',
    	'std'		=> '',
    	'type'		=> 'checkbox',
    	'choices'	=> array(
    		array(
    			'value' => '_blank',
    			'label' => 'Open in new window'
    		)
    	)
    )

    produces

    <p><input type="checkbox" name="option_tree[social-links][2][social-target][0]" id="social-links_social-target_2-0" value="_blank" class="option-tree-ui-checkbox "><label for="social-links_social-target_2-0">Open in new window</label></p>

    (note [social-target][0])

    and then, in the options table we see:

    s:12:"social-links";a:3:{i:0;a:5:{s:5:"title";s:8:"LinkedIn";s:11:"social-icon";s:11:"fa-linkedin";s:11:"social-link";s:19:"https://linkedin.com";s:12:"social-color";s:0:"";s:13:"social-target";a:1:{i:0;s:6:"_blank";}}i:1;a:4:{s:5:"title";s:7:"Twitter";s:11:"social-icon";s:10:"fa-twitter";s:11:"social-link";s:19:"https://twitter.com";s:12:"social-color";s:0:"";}i:2;a:5:{s:5:"title";s:8:"Facebook";s:11:"social-icon";s:11:"fa-facebook";s:11:"social-link";s:19:"https://facebook.com";s:12:"social-color";s:0:"";s:13:"social-target";a:1:{i:0;s:6:"_blank";}}}

    again, note that social-target is an array.

    This is correct. Option Tree even uses ot_convert_string_to_array when prepares defaults or imports from XML.

    Therefore, the Theme should get the first element of the array, because there is only one target=_blank option.

    Thank you!

    What version of the theme are you running?

    Thread Starter TIV.NET INC.

    (@tivnetinc)

    The one that came from https://www.ads-software.com/themes/hueman/

    (wrote that in my original post, by the way)

    If the social link “Open in new window” option is selected the current theme code will return the string “Array” for the target. Based on the HTML5 specification this is a valid context browsing name. The browser sees this as a request to open the link in a frame with the context name “Array”. If an active frame with that name is found, the link will be opened there. If the frame is not found, the link will be loaded in a new tab/window. Although this works from a usability standpoint, the technical coding perspective would suggest that the “_blank” parameter should be used if it exists, which it does. I’ll submit a request to the theme author for review.

    Thread Starter TIV.NET INC.

    (@tivnetinc)

    @bdbrown, it’s really very simple: checkboxes can be multiple. Therefore, array. In this specific case, need only one, first result. So, it’s array[0]. Case closed, in my opinion. ??

    Thanks again

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Possible bug in alx_social_links’ is closed to new replies.