Jump to content

PHP Code worked on 7.1 wont work on anything above


adman4054

Recommended Posts

Looking for a little help..... Error message --[] operator not supported for strings

Error  log points to this code:

<?php
$postnr = 1;
$catid = 136;
$args = array(
 'post__not_in'=> $do_not_duplicate,
  'posts_per_page' => $postnr,
  'cat' => $catid,
);
$wp_query = new WP_Query(); $wp_query->query($args); 
while ($wp_query->have_posts()) : $wp_query->the_post();
if (of_get_option('of_dnd_simple') == 1) { $do_not_duplicate[] = $post->ID; }	
?>
<p class="catname">
	<?php $catid = $catid; ?>
	<span><a href="<?php echo get_category_link($catid);?>" data-toggle="tooltip" title="<?php printf(esc_attr__('View all posts filed under %1$s','gabfire'), get_cat_name($catid) ); ?>"><?php echo get_cat_name($catid); ?></a></span>
</p>
<?php if (function_exists('z_taxonomy_image')) z_taxonomy_image(NULL, 'thumbnail'); ?>

Thank you

Link to comment
Share on other sites

Your array definition has a trailing comma.  NG

Why is that last function being tested?  Is it your function?  If so how can it be missing.  If not, why are you using a function that (somehow) could be missing?

You are establishing a query (?) or something from a WP_Query function.  But then you make it out to be a query that doesn't look like any sql I have ever seen.  

Link to comment
Share on other sites

I wasn't a fan of it for a long time either - things like "it makes diffs cleaner" just don't matter that much to me - but I slowly moved myself over into that camp over the last couple years. Mostly, I decided I kinda liked the consistency of all lines having those commas, rather than all lines except for the last one.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.