Forum Replies Created

Viewing 15 replies - 1 through 15 (of 16 total)
  • Thread Starter scnix

    (@scnix)

    Hi, I’ve managed to solve it by changing the get_posts to wp_query within the category.php.

    I first added this code to detect the current category viewed and filter the query to only display taken_check = 0.

    $this_cat = get_category(get_query_var('cat'), 'ARRAY_A', false);
    
    foreach ($this_cat as $this_cat){
    	$this_catid = $this_cat;
    	break;
    }
    
    $args = array(
        	'posts_per_page' => 10,
        	'post_type' => 'post',
    	'cat' => $this_catid,
    	'orderby' => 'title',
    	'order' => 'ASC',
    	'paged' => $paged,
       	'meta_query' => array(
    		array(
    			'key' => 'taken_check',
    			'value' => '0',
    		)
    	)
     );
    
    $wp_query = new WP_Query($args);

    I then just continued with the default loop sequence. The only weird code is the unnecessary foreach loop to detect the current category based on the current page and not from a post. Still puzzled as to why I can’t just use $this_cat[0] since it’s an array. It keep returning blank.

    Oh well, but it works now with pagination, so I’m happy ??
    Thanks for all the help!

    Thread Starter scnix

    (@scnix)

    Tried it, but it still doesn’t filter on the category pages.

    The code I placed was in category.php, which could be the reason why the meta query works there?

    Thread Starter scnix

    (@scnix)

    Unfortunately that doesn’t filter the category posts. It still lists them all.

    I did some really weird code that “sort of” worked, but it didn’t allow paging.

    $this_cat = get_category(get_query_var('cat'), 'ARRAY_A', false);
    
    foreach ($this_cat as $this_cat){
    	$this_catid = $this_cat; // for some reason I couldn't just use $this_cat[0], so in order to get the first array list, I did this
    	break;
    }
    
    $posts = get_posts(array(
        	'posts_per_page' => 10,
        	'post_type' => 'post',
    	'category' => $this_catid,
    	'orderby' => 'title',
    	'order' => 'ASC',
       	'meta_query' => array(
    		array(
    			'key' => 'taken_check',
    			'value' => '0',
    		)
    	)
    ));

    That did filter the category post nicely, but it it keeps displaying page 1 only.

    Thread Starter scnix

    (@scnix)

    I’ve been trying to experiment with the get_posts($args) but that will screw up the category.php posts.

    Is there a way to not query a new post list but still filter by the custom field within the category.php?

    Thread Starter scnix

    (@scnix)

    Wow, thanks. I didn’t expect to look into the include files.

    Anyways, if I were to update wordpress, will this file be updated and set to default as well?

    Also, after trying it out, I don’t seem to understand how to include those methods. Can you please provide me an example?

    Thread Starter scnix

    (@scnix)

    Oh, I added the no copy/paste script manually. As for my template, I didn’t use any (manually coded everything). So, I’m not too sure which code is conflicting with your contact form.

    Thread Starter scnix

    (@scnix)

    I had a script that disabled text highlighting to prevent copying and pasting.

    After removing that script, it worked fine.

    Thread Starter scnix

    (@scnix)

    Ok nvm, I just solved it. It was a script that disabled text selection for copy/pasting. Once removed, everything was fine.

    Thread Starter scnix

    (@scnix)

    This one : https://www.ads-software.com/extend/plugins/verve-meta-boxes/installation/

    Verve Meta Boxes

    I think I got it working. It pops up and alert when checked and doesn’t when not. Now I just need to figure out how set it to differentiate each individual post.

    Here’s the code I placed in the_loop

    <?php
       $detect_sold_out = get_post_custom_values('sold_out');
       if ($detect_sold_out == true) { ?>
           <script> alert('it works') </script>
    <?php } ?>

    ??

    Thread Starter scnix

    (@scnix)

    Hmm, ok I just installed a metabox plug in, do I just use the get_post_custom() to detect if the checkbox is checked?

    It doesn’t show what values it returns. Or does checkboxes just return a “true/false” value?

    I had the same problem, it was running smoothly and suddenly just stops working.

    I looked around and then I tried deactivating WP Super Cache plugin. Now it works fine again.

    Maybe try that, it might work. If not, deactivate each plugin 1 by 1 while refreshing your site to see which plugin is conflicting with Bumpbox.

    Thread Starter scnix

    (@scnix)

    Ok, I think I just solved it. There was a missing </DIV> within the comments.php file when there are no comments.

    I’m not too sure if this 100% fixes it, but it seems to work fine now when I just placed a </DIV> in the part where WordPress detects that the post has no comments.

    Thanks for the help! Wouldn’t have done it if you hadn’t showed me the validating site! ??

    Thread Starter scnix

    (@scnix)

    Hmm, I even tried removing the whole search input form and passed W3C’s validation. The Sidebar still gets pushed down. So at the moment, I’m also pretty sure it’s not the div tag errors.

    I’ve also copied and pasted the code into Dreamweaver to see where the errors are and hope that DW might have a more indepth explanation. What I got was, the rule for HTML is that you can’t put a <DIV> tag within a <ul> tag.

    Doubled checked with W3C’s error, and I realised that’s what the whole fuss is about.

    Anyways, I’ve removed the the search form from the <ul> tag and placed it outside with a negative margin to fit it back in place. W3C passes my site but the Sidebar is still bugged up.

    I’m seriously scratching my head over this and I think it’s beginning to bleed. ??

    Thread Starter scnix

    (@scnix)

    Ok, I fixed the PHP code displaying as a HTML text, but there are still some errors with my search bar div. I don’t see any problems with my <div> tags. Also, I doubt that’s the problem causing my sidebar to get pushed down. Simply because the other pages that has the sidebar in the correct position also displays the same search input div error.

    I’m pretty sure it has something to do with the comments part of the code. I just can’t determine what.

    I’ve even tried to place overflow:hidden for every div/tags that involves the comments but it still gets pushed down when there’s 1 or more comments.

    Thread Starter scnix

    (@scnix)

    Is it possible that you can’t parse PHP code in a PHP echo function?

Viewing 15 replies - 1 through 15 (of 16 total)