sonny_b
Forum Replies Created
-
Forum: Plugins
In reply to: A Few prolems need help with pleaseFor the first problem, you could always try something in your loop like:
<?php if($current_user->user_level !== '10' ) { // code to show ads } ?>
This checks if the current user is not an admin, and displays the ads if that’s true.
Forum: Plugins
In reply to: add rewrite rules for custom post typesHi – I’m trying to play around with Sivel’s code above but I’m struggling to achieve what I want. I have a custom post type named ‘work’, and a hierarchal taxonomy named ‘clients’ which is exclusive to the ‘work’ post panel. How could I achieve it so that visiting “domain.com/work/clients/client_x” would pull all the posts with that ‘client_x’ taxonomy? It’s the equivalent of visiting “domain.com/index.php?clients=client_x”, but I can’t get it to work. Here’s the code I’m trying:
add_action('generate_rewrite_rules', 'work_list'); function work_list($wp_rewrite) { $newrules = array(); $newrules['work/?$'] = 'index.php?post_type=work'; $newrules['work/page/?([0-9]{1,})/?$'] = 'index.php?post_type=work&paged=$matches[1]'; $newrules['work/clients/?([0-9]{1,})/?$'] = 'index.php?clients=?$])'; $wp_rewrite->rules = $newrules + $wp_rewrite->rules; }
Thanks!
Forum: Fixing WordPress
In reply to: Adding a new orderby= functionRegarding pagination –
I found some great help from Aesqe here:https://www.ads-software.com/support/topic/154300?replies=7
But I can’t get it working with the Paginav plugin. Anyone have any thoughts?
Forum: Fixing WordPress
In reply to: Adding a new orderby= functionFantastic, I got it working with the following code:
<ul class="crewlist"> <?php $querystr = " SELECT * FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON($wpdb->posts.ID = $wpdb->postmeta.post_id) LEFT JOIN $wpdb->term_relationships ON($wpdb->posts.ID = $wpdb->term_relationships.object_id) LEFT JOIN $wpdb->term_taxonomy ON($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) WHERE $wpdb->term_taxonomy.term_id = 4 AND $wpdb->term_taxonomy.taxonomy = 'category' AND $wpdb->posts.post_status = 'publish' AND $wpdb->postmeta.meta_key = 'crew_order' ORDER BY $wpdb->postmeta.meta_value ASC LIMIT 9 "; $crew_order = $wpdb->get_results($querystr, OBJECT); ?> <?php if ($crew_order): ?> <?php foreach ($crew_order as $post): ?> <?php setup_postdata($post); ?> <li><?php if ($currentId!==$post->ID) { ?><a href="<?php the_permalink();?>"><?php the_title(); ?></a><?php } else { ?><?php the_title(); ?><?php } ?></li> <?php endforeach; ?> <?php endif; ?> </ul>
Is there any way to get it to auto paginate once the LIMIT has been reached?
Thanks so much for the help.
Forum: Fixing WordPress
In reply to: Adding a new orderby= functionThanks, I’ll check those out.
Forum: Fixing WordPress
In reply to: how to disable attachment pageSuperb, thanks!
Forum: Fixing WordPress
In reply to: how to disable attachment pageAlso, this is only relevant to galleries. Single image links correctly function as their settings dictate.
Forum: Fixing WordPress
In reply to: how to disable attachment pageI would also really love to know if this is possible. I just want Gallery links to open the images in a new browser window, but no matter what I choose the file link to be in the Media Library, it still forces it to go to the Attachment page.
Forum: Fixing WordPress
In reply to: Restricting Date Archive to one categoryNever mind, all figured out now. Using ‘query_string’ seemed to do the trick. Inserted this before the Loop:
<?php query_posts($query_string . '&cat=5'); ?>
Forum: Fixing WordPress
In reply to: Restricting Date Archive to one categoryAnyone have any thoughts at all?
ThanksMight want to adapt some of the code posted here:
https://www.ads-software.com/support/topic/152904?replies=34Forum: Fixing WordPress
In reply to: Theme not centeredTry setting the body class in the CSS to
‘margin: 0 auto;’
Should fix it.
If you’re comfortable with Template Tags and editing theme files, then try:
https://codex.www.ads-software.com/Template_Tags/wp_list_pages#Exclude_Pages_from_List
Otherwise a plugin can achieve this: