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.

 

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
New Webmasters ask "How-To" questions here. This is where other fucking Webmasters help.

 
Thread Tools
Old 07-01-2015, 08:10 PM   #1
lollipopx
Confirmed User
 
lollipopx's Avatar
 
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.
lollipopx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 07-02-2015, 06:27 AM   #2
johnny_r
Registered User
 
johnny_r's Avatar
 
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
johnny_r is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 07-02-2015, 11:44 AM   #3
lollipopx
Confirmed User
 
lollipopx's Avatar
 
Industry Role:
Join Date: Apr 2014
Posts: 171
Quote:
Originally Posted by johnny_r View Post
Just add the following: 'category_name=yourCategorySlug'.
For example:
<?php $args = array( 'numberposts' => 42, 'orderby' => 'rand', 'category_name=blowjobs' );

That should do it ;)
Thanks. Seemed to almost work.
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.
lollipopx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 07-03-2015, 12:37 AM   #4
Venum
Confirmed User
 
Venum's Avatar
 
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
Venum is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 07-03-2015, 10:38 AM   #5
lollipopx
Confirmed User
 
lollipopx's Avatar
 
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.
lollipopx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 07-03-2015, 12:39 PM   #6
lollipopx
Confirmed User
 
lollipopx's Avatar
 
Industry Role:
Join Date: Apr 2014
Posts: 171
Quote:
Originally Posted by Venum View Post
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
Im doing something wrong here, I keep getting parse errors
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.
lollipopx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 07-03-2015, 09:31 PM   #7
Venum
Confirmed User
 
Venum's Avatar
 
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)
Venum is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 07-04-2015, 12:50 PM   #8
lollipopx
Confirmed User
 
lollipopx's Avatar
 
Industry Role:
Join Date: Apr 2014
Posts: 171
Quote:
Originally Posted by Venum View Post
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)
Awesome, works good. thanks

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.
lollipopx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
 
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks

Tags
categories, tags, script, oral, selected, videos, blowjobs, display, random, specific



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.