![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
|
New Webmasters ask "How-To" questions here. This is where other fucking Webmasters help. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Industry Role:
Join Date: Apr 2014
Posts: 171
|
a little script help needed
how to tell the following script to use specific categories and tags rather than random?
so it will display just the categories and tags i want it too. ie blowjobs, oral...etc.. <h2 class="post-title">Videos selected for you</h2> <?php $args = array( 'numberposts' => 42, 'orderby' => 'rand' ); $rand_posts = get_posts( $args ); foreach( $rand_posts as $post ) : ?> <div class="post" id="post-<?php the_ID(); ?>"> <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail(array(240,180), array('alt' => get_the_title(), 'title' => '')); ?></a> <?php if ( get_post_meta($post->ID, 'duration', true) ) : ?><div class="duration"><?php echo get_post_meta($post->ID, 'duration', true) ?></div><?php endif; ?> <div class="link"><a href="<?php the_permalink() ?>"><?php short_title('...', '34'); ?></a></div> <span>Added: <?php the_time('F j, Y'); ?> at <?php the_time('g:i a'); ?></span> <span><?php the_tags('Tags: ', ', ', ''); ?></span> </div> <?php endforeach; ?> <div class="clear"></div>
__________________
Lollipopx.com Twitter @lollipopx_1, Tumblr lollipop-x, ICQ 669068563, Skype lollipop_130 Tell me your from gfy or i might ignore you. |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#2 |
Registered User
Industry Role:
Join Date: Aug 2014
Posts: 99
|
Just add the following: 'category_name=yourCategorySlug'.
For example: <?php $args = array( 'numberposts' => 42, 'orderby' => 'rand', 'category_name=blowjobs' ); That should do it ;)
__________________
![]() Adult-Wordpress-Theme.com Create Adult Tube sites based on Wordpress with Mass Video Embedder and Autopilot. $20 Discount code: GFY20 |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#3 | |
Confirmed User
Industry Role:
Join Date: Apr 2014
Posts: 171
|
Quote:
only it still pulls from all categories or something. The chosen categories show up more but not totaly. Is it possable to exclude categories and how would that be added? also can tags be used rathe than categories? or would that matter? Has not changed anything as far as on my mobile, no clue on whats up there. I would like for it to randomize selections from a couple specific categories and/or tags. not all
__________________
Lollipopx.com Twitter @lollipopx_1, Tumblr lollipop-x, ICQ 669068563, Skype lollipop_130 Tell me your from gfy or i might ignore you. |
|
![]() |
![]() ![]() ![]() ![]() |
![]() |
#4 |
Confirmed User
Industry Role:
Join Date: Nov 2014
Posts: 182
|
For excluding categories, example:
'category__not_in' => array(catID, catID) For including categories, example: 'category__in' => array(catID, catID) For tags: tag__in & tag__not_in |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#5 |
Confirmed User
Industry Role:
Join Date: Apr 2014
Posts: 171
|
OK I'll give that a try.
How can I get it to randomize from the selected cats? I have been trying 'rand' in just about ever possible way but only randomizes all cats.
__________________
Lollipopx.com Twitter @lollipopx_1, Tumblr lollipop-x, ICQ 669068563, Skype lollipop_130 Tell me your from gfy or i might ignore you. |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#6 | |
Confirmed User
Industry Role:
Join Date: Apr 2014
Posts: 171
|
Quote:
where exactly does it go? <?php $args = array( 'numberposts' => 42, 'orderby' => 'category_name=blowjobs');'category__not_in' => array(catID, catID); didnt work got parse error <?php $args = array( 'numberposts' => 42, 'orderby' => 'category__not_in' => array(catID, catID); didnt work got parse error what I have on now that works at displaying 1 cat but does not randomize it <?php $args = array( 'numberposts' => 42, 'orderby' => 'category_name=blowjobs'); for that I just replaced the 'orderby' => 'rand'); with the 'orderby' => 'category_name=blowjobs'); would like to add a few more categories and have it randomize them
__________________
Lollipopx.com Twitter @lollipopx_1, Tumblr lollipop-x, ICQ 669068563, Skype lollipop_130 Tell me your from gfy or i might ignore you. |
|
![]() |
![]() ![]() ![]() ![]() |
![]() |
#7 |
Confirmed User
Industry Role:
Join Date: Nov 2014
Posts: 182
|
You have to replace catID with your category ID, example if your category ID for blowjobs is 43:
<?php $args = array( 'numberposts' => 42, 'orderby' => 'rand', 'category__in' => array(43) ); If you like to exclude category, then replace category__in to category__not_in. If you like to include or exclude multiple categories the you can but them like this: array(43, 56, 78) |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#8 | |
Confirmed User
Industry Role:
Join Date: Apr 2014
Posts: 171
|
Quote:
As im sure your aware this is in side word press themes page php editor. so although its on each "Page" its not actualy "in" page if you follow me. How could I use this "in" page, say like so it can randomize to specific posts/cats like a featured post ?
__________________
Lollipopx.com Twitter @lollipopx_1, Tumblr lollipop-x, ICQ 669068563, Skype lollipop_130 Tell me your from gfy or i might ignore you. |
|
![]() |
![]() ![]() ![]() ![]() |