Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

PHP? Moving boxes? I'm not sure what the problem is. WordPress

  • SOLVED

On the live site I get this:

http://dontapscott.com/about/#&slider1=2

As you can see in the slider there's an error and none of the entries are returned.

The error seems to be: Warning: : urldecode() expects parameter 1 to be string, array given in /home/dontapsc13/domains/dontapscott.com/public_html/wp-includes/query.php on line 1722.


On the dev site I get this:

http://dontapscott.patienceandfortitude.com/about/

Slider looks fine and works fine.

I just migrated it twenty minutes ago and they're identical, so I think it must be a server issue, but maybe I'm wrong?

Answers (4)

2011-12-04

Christianto answers:

Hi,

I think you cannot use array for cat argument for the query
<?php $highlightsarchive = new WP_Query( array( 'posts_per_page' => '-1', 'featured-areas' => 'highlights', 'cat' => array( 4, 5, 6, 33 ) ) ); ?>

it should be only string..

if you have to use an array of category then use category__in
<?php $highlightsarchive = new WP_Query( array( 'posts_per_page' => '-1', 'featured-areas' => 'highlights', 'category__in' => array( 4, 5, 6, 33 ) ) ); ?>


Please read the list of argument support on[[LINK href="http://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters"]] wp query class[[/LINK]]

hope this help..


Christopher comments:

And that's the winner. Fixed it perfectly.

I wonder why it worked on the dev server but not the live server with the old code.

Regardless thanks very much.

2011-12-04

Sébastien | French WordpressDesigner answers:

probably you don't display the same errors in your live site and in your test site. Are they in the same server ?

The rror isn't display on the first server and it is on the second. But i advice you to modify the code. The function urldecode must have an argument and it seems that's not the case in your code


Christopher comments:

They're on different servers.

But it's not the display of the error message that concerns me, it's that they don't have the same result.

2011-12-04

Luis Abarca answers:

Can you post the code of your slider ? please


Christopher comments:

The slider is moving boxes https://github.com/chriscoyier/MovingBoxes

The footer code is:

<script>
jQuery(document).ready(function($){

$('#aboutslider').movingBoxes({
startPanel : 3, // start with this panel
width : 630, // overall width of movingBoxes (not including navigation arrows)
wrap : false, // if true, the panel will "wrap" (it really rewinds/fast forwards) at the ends
buildNav : true, // if true, navigation links will be added
panelWidth : 0.6,
reducedSize : 0.8,
fixedHeight : false,
navFormatter : function(){ return "&#9679;"; } // function which returns the navigation text for each panel
});

});
</script>


In the page template it's:


<section id="highlights" class="grid8 first">

<h3 class="sectionheader"><span>Highlights</span></h3>

<ul id="aboutslider">

<?php $highlightsarchive = new WP_Query( array( 'posts_per_page' => '-1', 'featured-areas' => 'highlights', 'cat' => array( 4, 5, 6, 33 ) ) ); ?>

<?php if ($highlightsarchive->have_posts()): while ($highlightsarchive->have_posts()): $highlightsarchive->the_post(); ?>

<li>
<?php the_post_thumbnail( 'highlights' ); ?>
<h2>
<?php $urllink = get_post_meta($post->ID, link_url, true);
if($urllink){ ?>
<a class="lightbox" href="<?php echo get_post_meta($post->ID, 'link_url', true); ?>">
<?php the_title() ?>
</a>
<?php }else{ ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
<?php the_title() ?>
</a>
<?php } ?>
</h2>
</li>

<?php endwhile; ?>

<?php endif; ?>

</ul>

</section><!-- end Highlights -->



Luis Abarca comments:

<strong><?php $urllink = get_post_meta($post->ID, 'link_url', true); ?></strong>


Luis Abarca comments:

Try this


<section id="highlights" class="grid8 first">
<h3 class="sectionheader"><span>Highlights</span></h3>
<ul id="aboutslider">

<?php $highlightsarchive = new WP_Query( array( 'posts_per_page' => '-1', 'featured-areas' => 'highlights', 'cat' => array( 4, 5, 6, 33 ) ) ); ?>

<?php if ($highlightsarchive->have_posts()): while ($highlightsarchive->have_posts()): $highlightsarchive->the_post(); ?>

<li>
<?php the_post_thumbnail( 'highlights' ); ?>
<h2>
<?php $urllink = get_post_meta($post->ID, 'link_url', true);
if ( !empty($urllink) ) { ?>
<a class="lightbox" href="<?php echo $urllink ?>">
<?php the_title() ?>
</a>
<?php }else{ ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
<?php the_title() ?>
</a>
<?php } ?>
</h2>
</li>
<?php endwhile; ?>
<?php endif; ?>
</ul>
</section><!-- end Highlights -->


Christopher comments:

Made no difference.


Luis Abarca comments:

And as Just Me said, you have error 404 in some files


Christopher comments:

Yeah, I know. They're to unused CSS files that I didn't delete from the template yet.

I think the problem depends on figuring out what's different between the servers. You'll note that it looks fine on the dev one.


Luis Abarca comments:

<script>
jQuery(document).ready(function($)
{
$(".listitem").hide();
$(".listitem").slice(0, 6).show();

$(".more").click(function(){
var showing = $(".listitem:visible").length;
$(".listitem").slice(showing - 1, showing +6).show();
});
<strong>}</strong> // add this
</script>


Luis Abarca comments:

You have:

<script>
jQuery(document).ready(function($){
$(".listitem").hide();
$(".listitem").slice(0, 6).show();

$(".more").click(function(){
var showing = $(".listitem:visible").length;
$(".listitem").slice(showing - 1, showing +6).show();
});
</script>


Should be:

<script>
jQuery(document).ready(function($)
{
$(".listitem").hide();
$(".listitem").slice(0, 6).show();

$(".more").click(function()
{
var showing = $(".listitem:visible").length;
$(".listitem").slice(showing - 1, showing +6).show();
});
<strong>});</strong>
</script>

2011-12-04

Just Me answers:

you have a few errors on your page, some things can not be found/loaded.

Failed to load resource: the server responded with a status of 404 (Not Found)
http://dontapscott.com/wp-content/themes/dtapscott/css/jquery-ui-1.8.11.custom.cssFailed to load resource: the server responded with a status of 404 (Not Found)
http://dontapscott.com/wp-content/themes/dtapscott/css/movingboxes.cssFailed to load resource: the server responded with a status of 404 (Not Found)
/about/Uncaught SyntaxError: Unexpected end of input
3Unsafe JavaScript attempt to access frame with URL https://api.twitter.com/xd_receiver.html from frame with URL about:blank. Domains, protocols and ports must match.