Does any one here know of a plug in that allows me to limit the categories to which an author can post? I would like to allow my authors to post to more than one categories. So that for example a post about crime shows on TV could be posted in both “TV” and “Crime Shows”. At the same time the author should not be able to post to all availabe plugins. The number of categories I would allow is two.
Thanks a lot in advance:D
]]>Thank You
PS: Please see the code below, will be greatly appreciated if someone can edit it for me to fit my need.
—-
<p>Your Email
[email* your-email] </p>
<p>Video URL
[url* video-url] </p>
<p>Video Title
[text* video-title] </p>
<p>Video Description
[textarea* video-description] </p>
<p>Tags
[text* tag] </p>
<p>Categories
[category] </p>
<p>Insert text below
[captchac captcha-528 size:m]
[captchar captcha-528]
</p>
<p>[submit “SUBMIT”]</p>
https://www.ads-software.com/plugins/contact-form-7/
]]>I am calling the shortcode in a page template like this:
<?php echo do_shortcode("[upzslider usingphp=true interid='5' intertype='post']"); ?>
The Slider is working, but it just loads any new post with a featured image.
How do I limit the slider to just 1 category?
https://www.ads-software.com/plugins/unpointzero-slider/
]]>I have been able to show only two categories on the home page and limit it to a maximum of only 4 posts in total but I cannot for the life of me work out/find out how to show 2 posts from each of the two categories.
Anyone?
Here is what I have so far…
if (is_home()) {
query_posts($query_string . "&cat=7,8&posts_per_page=4");
}
This code is on home.php.
Thanks in advance
]]><?php
global $wp_query;
$cats = get_categories('number=10');
foreach ( $cats as $c ) {
$url = get_category_link( $c->term_id );
$img = $taxonomy_images_plugin->get_image_html( 'medium', $c->term_taxonomy_id );
if( !empty( $img ) )
print '<div class="aheadline"></div>';
print '<a href="' . $url . '">' . $img . '</a>';
print '<div style="float:right;"><a href="'. get_category_link($c).'" title="'. strip_tags($catdesc) .'">'. $c->cat_name . '</a></div><a href="' . get_category_link($c) . '" title="'. strip_tags($cdesc) .'"></a>';
print '<a href="';
print ''. the_permalink() .'';
print '">';
print ''. the_title() .'';
print '</a>';
print '<br>';
}
?>
and also want pagination to this code
hear this code look a like
This blog post describes how to add custom functions to the themes functions.php to only show certain categories in the archive widget: https://illuminatikarate.com/blog/wordpress-how-to-exclude-categories-from-the-archive-widget/
I added the following code to functions.php:
//add the ik archive filters
add_filter('getarchives_where','ik_custom_archives_where',10,2);
add_filter('getarchives_join','ik_custom_archives_join',10,2);
//add custom SQL to the archives widget JOIN clause
function ik_custom_archives_join($sql){
global $wpdb;
$sql = $sql . "LEFT JOIN $wpdb->term_relationships ON($wpdb->posts.ID = $wpdb->term_relationships.object_id) ";
$sql = $sql . "LEFT JOIN $wpdb->term_taxonomy ON($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) ";
return $sql;
echo $sql;
return $sql;
}
//add custom SQL to the archives widget WHERE clause
function ik_custom_archives_where($sql){
global $wpdb;
//get categories IDs from slugs
$include_cat_1 = get_category_by_slug("blog");
echo ''; var_dump( $include_cat_1 ); echo '';
//list of cats to exclude
//add more ID's to this comma-separate list to include more categories
$include_list = $include_cat_1->cat_ID;
$sql = "WHERE post_type = 'post' AND post_status = 'publish' ";
$sql = $sql . "AND $wpdb->term_taxonomy.term_id IN ($include_list)";
echo $sql;
return $sql;
}
However, when I add this code to functions.php, the archive widget does not show anything.
I added some debug statements. I get the follwing output:
object(stdClass)#4295 (15) {
[“term_id”]=>
&string(2) “10″
[“name”]=>
&string(4) “Blog”
[“slug”]=>
&string(4) “blog”
[“term_group”]=>
string(1) “0″
[“term_taxonomy_id”]=>
string(2) “10″
[“taxonomy”]=>
string(8) “category”
[“description”]=>
&string(0) “”
[“parent”]=>
&string(1) “0″
[“count”]=>
&string(1) “0″
[“cat_ID”]=>
&string(2) “10″
[“category_count”]=>
&string(1) “0″
[“category_description”]=>
&string(0) “”
[“cat_name”]=>
&string(4) “Blog”
[“category_nicename”]=>
&string(4) “blog”
[“category_parent”]=>
&string(1) “0″
}
WHERE post_type = ‘post’ AND post_status = ‘publish’ AND wp_term_taxonomy.term_id IN (10)
LEFT JOIN wp_term_relationships ON(wp_posts.ID = wp_term_relationships.object_id) LEFT JOIN wp_term_taxonomy ON(wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id)
I am new to WordPress. Can anyone give me some hints what’s going wrong here or how to debug the problem?
Best regards,
Michael
on the homepage, the post in category 6/12 shows both category names. i want it to display only the category 6 name.
anyone know how to do this? here is the current loop
<!-- LATEST NEWS -->
<?php
$post_ids = array(0);
foreach( array(1,2,4,5,6,7,8,9,10,11,13,14,15,16,17) as $cat_id ) {
if ( $posts = get_posts(array('cat' => $cat_id, 'showposts' => 15)) ) {
$first = array_shift($posts);
$post_ids[] = $first->ID;
}
}
query_posts(array('post__in' => $post_ids));
?>
<?php while (have_posts()) : the_post(); ?>
<div class="latest-post-wrap">
<div class="latest-post">
<div class="latest-title">
<h2><?php the_category(' / ') ?></h2>
</div>
<div class="latest-image">
<a href="<?php the_permalink() ?>">
<?php if ( get_post_meta($post->ID, 'image', true) ) : ?>
<img src="<?php bloginfo('template_url'); ?>/mainimagecrop.php?w=162&h=118&f=<?php echo get_post_meta($post->ID, 'image', true) ?>" />
<?php endif; ?>
</a>
</div>
</div>
<div class="latest-content">
<span style="font-size:14px; color:#5CB7CC;font-weight:bold;text-transform:uppercase;"><br /><?php the_title(); ?></span><br />
<div class="postMeta-front">
<span class="date"><?php the_time('F j, Y') ?></span>
<span class="comments"><?php comments_popup_link('0', '1', '%'); ?></span>
</div>
<div class="clear"></div>
<p>
<?php
$excerpt = get_the_excerpt();
echo string_limit_words($excerpt,30);
?>
</p>
<p class="moretext"><a href="<?php the_permalink() ?>">Continue Reading...</a></p>
</div>
</div>
<?php endwhile; ?>
<!-- LATEST NEWS END -->
]]>What I am ideally looking for is the ability to add one user from each club but I want to be able to limit their ability to only add posts into their pre-set category? (say by ticking a box for the allowed categories when I add the user)
For example there may be a surf club in Newcaslte and a surf club in Brisbane. If I add a user for each, is there the ability make it so only… say 2 categories are listed for the brisbane one to tick when creating a post (like QLD Clubs, Brisbane Surf Club)… rather than all of them?
I have installed “User Access Manager” but I don’t think it does what I am after.
Hope that makes sense.
Thankyou very much for your help.
So far I copied the wp-list-categories function, renamed it and set the default parameters how I want them. Needless to say, adding the “number” parameter defaulting to 3 also screws up the return (three items from a long time ago, then ordered by order).
Could someone please help me out. There must be a way to just manually get the first three items after all querying is done. ?
This is all related to my post here.
Any help would be greatly appreciated!
]]>