w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
how to get all the id's of posts made under specific category in wordpress
I hope below are the posts of web articals Frame Work <----- these are my post titles Open Source Model–View–Controller (MVC) If it is so, then use the_ID() function like you have used the_title();.

Categories : Wordpress

Hide specific posts from category list in wordpress
Try this: Apply Custom Fields Parameters in get_post query itself. $posts = get_posts(array( 'posts_per_page' => 10, 'post_type' => '<YOUR_POST_TYP>', 'meta_key' => 'taken_check', 'meta_value' => '<DEFAULT_VALUE_OF_taken_check>' )); Lots to read here: http://codex.wordpress.org/Template_Tags/get_posts

Categories : PHP

Display featured posts from a specific WordPress category
Try this: $sticky=get_option('sticky_posts'); $query_args=array( 'post__in' => $sticky, 'category__in'=>array($category) ); $the_query = new WP_Query($query_args); You can get the top 5 sticky posts using rsort and array_slice as shown in http://codex.wordpress.org/Sticky_Posts

Categories : PHP

Show only posts related to category or page wordpress
For connect this category to this page you can set product to category archive page from wp-admin/nav-menus.php you can create a simple page template to list category post you can use http://wordpress.org/plugins/list-category-posts/ plugin and use short code like [catlist name="news"] in you page content.

Categories : Wordpress

Wordpress related posts only show the last three posts in the category. Is there a way to randomize every related post?
Add orderby rand in your arguments and use it like below, <?php $posts = get_posts('orderby=rand&numberposts=5'); foreach($posts as $post) { ?> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a> <?php } ?>

Categories : Javascript

wp category showing all posts from all categories instead of specific posts from specific category
Since you are creating your own WP_Query you have to precise the actual filter you are using. For categories look at the relevant documentation here: http://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters Note that if you are modifying the category.php template you are already inside the wordpress Loop and you do not need to specify your own WP_Query. You can simply use a while(have_posts() ): ... endwhile; loop. I would recommend downloading the TwentyTwelve theme and observing its inner workings.

Categories : PHP

Wordpress PHP posts using category as query
In order to only display posts from a single category (or subcategory), you do not need to write any code on page.php file of wordpress. If you want to modify the way posts or list of posts work, on twenty twelve theme, check the file category.php. In order to display the posts of the wanted category you only have to call the category's link. For example, in order to show all the posts on BTCC category, just use this url: http://talkativebroadcasting.co.uk/category/BTCC/ In the same way, you can show all categories you need.

Categories : PHP

How to get the unique tags of the posts under a category in wordpress?
The best workaround is to write custom SQL query and fetch all tags at once. Any other approach which uses WP core functions will generate tons of small SQL queries, what is redundant. Use this query to fetch all category tags: SELECT DISTINCT pt.term_id, pt.name FROM wp_terms AS t LEFT JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id LEFT JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id LEFT JOIN wp_term_relationships AS ptr ON ptr.object_id = tr.object_id AND ptr.term_taxonomy_id <> tr.term_taxonomy_id LEFT JOIN wp_term_taxonomy AS ptt ON ptt.term_taxonomy_id = ptr.term_taxonomy_id AND ptt.taxonomy = 'post_tag' LEFT JOIN wp_terms AS pt ON pt.term_id = ptt.term_id WHERE t.name = 'Car' AND tt.taxonomy = 'category' AND pt.term_id IS NOT

Categories : Wordpress

Can not query posts by category in WordPress loop
If you use the query you're using query_posts('cat=###') then you need to give the query the category Id not the name. If you don't know the Id offhand, you can find it before you do the query with something close to this: $categories = get_the_category(); //gets all the categories $i=1; $name='design'; $id=''; while(count($categories) > i){ //Loops through the categories if(($categories[$i-1]->cat_name)==$name){ $id=$categories[$i-1]->cat_ID; //Sets the variable $id to be the id you need } i++; }; $id should be the category Id you need to do the query you were using.

Categories : PHP

Wordpress display category posts on different page
Creating a template for this is a solution, but I think it will only work efficiently if you have small number of categories. Try using: http://wordpress.org/plugins/wp-no-category-base/ http://wordpress.org/plugins/top-level-cats/ I think there are other available plugins to do this.

Categories : PHP

Fetch WordPress sticky posts from category
I'm assuming that you defined your $category somewhere as RST mentioned? <?php /* Get all sticky posts */ $sticky = get_option( 'sticky_posts' ); /* Sort the stickies with the newest ones at the top */ rsort( $sticky ); /* Get the 5 newest stickies (change 5 for a different number) */ $sticky = array_slice( $sticky, 0, 5 ); /* Query sticky posts */ $query_args = array( 'post__in' => $sticky, 'category__in'=>array($category) ); ?> $my_query = new WP_Query($query_args); ?> <?php while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate = $post->ID; ?>

Categories : PHP

Wordpress: Changing a posts category after a comment is posted
<?php $args = array('post_type' => 'post'); $post_obj = new WP_Query($args); while($post_obj->have_posts() ) : $post_obj->the_post(); //display posts with comments $comments = get_comments(array( 'post_id' => $post->ID)); foreach($comments as $comment) { echo '<li>'.the_permalink().'</li>'; } endwhile; ?>

Categories : Wordpress

Wordpress: alphabetice posts using custom category template
With the piece of code you have there you are including a loop in a loop. Using get_posts() with a foreach loop is essentially a WP loop, then you are including get_template_part('loop', 'designers'); which is more than likely another loop. You can remove get_template_part('loop', 'designers'); from your piece of code and just stick in your tags to get the desired content, (i.e the_content(); the_title; the_excerpt; etc..) or you can create a new loop with wp_query() like the below example. <?php $query = new WP_Query(array('post_type' => 'post', 'cat' => 1, 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC')); while ( $query->have_posts() ) : $query->the_post(); ?> // put your content template tags here <?php endwhile; wp_reset_p

Categories : Wordpress

Plugin WordPress JSON API - How get posts for category with offset?
You can't use get_category_posts with offset. You have to construct the query from the basic get_posts which has a lot of parameters, see here: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters and here (read Method: get_posts): http://wordpress.org/plugins/json-api/other_notes/ I think you should use something like: blablabla.xxx/?json=get_posts&count=10&status=published&cat='id of the category news'&offset='int offset' Be aware that use offset 'breaks' pagination

Categories : Json

Show Wordpress Category Based on Category Name's Content
I think, you may try this global $wpdb; $query = SELECT GROUP_CONCAT( wp_terms.term_id ) AS IDS FROM wp_term_relationships LEFT JOIN wp_term_taxonomy ON ( wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id ) LEFT JOIN wp_terms ON wp_term_taxonomy.term_taxonomy_id = wp_terms.term_id WHERE wp_term_taxonomy.taxonomy = 'category' AND wp_terms.name LIKE '*%' $ids = $wpdb->get_var($query); wp_list_categories("include=$ids");

Categories : Wordpress

Show posts in random order from category loop
Use shuffle( $array ); to shuffle elements in array. $categories = get_categories(); shuffle( $categories ); foreach( $categories as $category ){ //Your stuff } Hope it helps!

Categories : PHP

Show Posts from Another WordPress Site
Easiest thing to do is use RSS. See FeedWordPress | simple and flexible Atom/RSS syndication for WordPress and Developer's Guide - Google AJAX Feed API - Google Code and Magpie RSS - PHP RSS Parser for different ways to implement RSS feeds as links or import posts themselves.

Categories : PHP

How to show WordPress author.php when user has no posts?
Could you not make your own query? haveno_posts{ If Posts = 0 then return true? } <?php if ( have_posts() ) : ?> would be <?php if ( have_posts() || haveno_posts() ) : ?> alternatively: http://wordpress.org/plugins/show-authors-without-posts/admin/ http://wordpress.stackexchange.com/questions/41078/show-author-archive-pages-for-authors-with-no-posts

Categories : PHP

Show related posts by taxonomy Wordpress
Did you tried adding the following argument to your WP_Query array of arguments? 'tax_query' => array(array('taxonomy' => 'product_cat')) The code will look like this (of course after removing the category parameter): <?php global $post; $loop = new WP_Query( array( 'post_type' => 'product','post__not_in' => array($post->ID), 'tax_query' => array(array('taxonomy' => 'product_cat'))) ); ?> <?php while ( $loop->have_posts() ) : $loop->the_post(); ?> <?php the_title( '<h2 class="entry-title"><a href="' . get_permalink() . '" title="' . the_title_attribute( 'echo=0' ) . '" rel="bookmark">', '</a></h2>' ); ?> <?php endwhile; ?>

Categories : PHP

Show different content on each category in Wordpress
You can look at this really old forum post, which pretty much just says use the is_category() function if(is_category(9)) { //show come banner } else if(is_category(10)) { //show another banner } else { //show default banner } ?>

Categories : PHP

Displaying posts thumbnails in Wordpress show only first thumbnail
run 2 queries one outputs the first post. The second outputs everything else excluding the first <?php $args = array( 'post_type' => 'attachment', 'posts_per_page' => 1, 'post_parent' => $post->ID); $first = new WP_Query( $args ); while ( $first->have_posts() ) : $first->the_post(); ?> <a href="<?php echo get_permalink();?>"><?php the_title();?><?php echo wp_get_attachment_image( $first->ID, 'thumbnail' );?></a> <?php endwhile; wp_reset_postdata(); ?> <?php $args2 = array( 'post_type' => 'attachment', 'posts_per_page' => 1, 'post_parent' => $post->ID, 'offset' => 1); $rest = new WP_Query( $args2 ); while ( $rest->have_posts() ) : $rest->the_post(); ?> <a href="<?php echo get_permalink();

Categories : PHP

Wordpress: how to limit post-nav to specific category?
That's covered in the WP docs. Set in_same_cat to true. http://codex.wordpress.org/Function_Reference/next_post_link If the links are already in your theme, you'll need to edit them.

Categories : Wordpress

show post titles below each category wordpress
First of all, your code is broken which might break your theme so the posts don't show up. The last line before endforeach lacks closing tags for and . Also php opening and closing tags are present inside the PHP code, which is very wrong. $show_count = 0; $pad_counts = 0; $hierarchical = 1; $taxonomy = 'filter'; $title = true; $description = true; $args = array( 'show_count' => $show_count, 'pad_counts' => $pad_counts, 'hierarchical' => $hierarchical, 'taxonomy' => $taxonomy, 'use_desc_for_title' => $description, 'title_li' => $title ); $categories=get_categories($args); foreach($categories as $category) { echo '<p>Category: <a

Categories : Wordpress

Can I get a specific number of posts per author and order by date in Wordpress?
I could be wrong, but I don't think this is possible with just one query since there isn't (to my knowledge) a way to specify how many posts per author. It will add to your load time a little bit, but you might have to split it out into 6 different queries to get it to work. You can do this by using WP_Query (your probably shouldn't use query_posts as it will change your main query) and wrapping each query in the specific author block: $author1 = new WP_Query(array('cat'=>3,'author'=>$author1ID,'posts_per_page'=>12)); if($author1->have_posts): while($author1->have_posts()): $author1->the_post(); ?> <!--Insert HTML etc. here--> <?php endwhile; endif; wp_reset_query(); //reset the query object if running in the loop T

Categories : Wordpress

List posts by month with specific HTML markup - Wordpress
The problem you have there is that you're looping through the posts and you're going to get a date for each post. Instead, you want to detect what month you're on. Here's what my loop would look like. <?php if (!empty($myposts)) : global $post; $month = date( 'n', strtotime($myposts[0]->post_date) ); ?> <a href="#" class="trigger current"><?php echo date('F Y', strtotime($myposts[0]->post_date)) ?> <div class="pane wdiv"> <ul> <?php foreach ( $myposts as $post ) : setup_postdata($post); if (get_the_time('n') !== $month) : ?> </ul> <div style="clear:both;"></div> </div> <a href="#" class="trigger current"><?php the_time('F Y') ?></a&g

Categories : PHP

WordPress - show most read posts in 7 days, query by filter
Here is the plugin WP Plugin: Top 10 posts and Views per post download this plugin and edit top10.php replace the function show_pop_posts() with this one function show_pop_posts() { global $wpdb, $siteurl, $tableposts, $id; $results = $wpdb->get_results("select postnumber, cntaccess from mostAccessed ORDER BY cntaccess DESC LIMIT 7"); echo "<ul>"; if ($results) { foreach ($results as $result) { echo '<li><a href="'.get_permalink($result->postnumber).'">'.get_the_title($result->postnumber).'</a> ('.$result->cntaccess.')</li>'; } } echo "</ul>"; }

Categories : PHP

Wordpress show posts from children terms of a taxonomy term
Try getting all the term children of the current term you are displaying. Then looping through each of those and pulling the posts for each term. You could do something like the below: <?php $taxonomies = get_term_children( $id, 'custom_cat'); foreach($taxonomies as $tax){ $term = get_term_by( 'id', $child, $taxonomy_name ); get_posts(array('cat'=>$term['id'])); } ?>

Categories : Wordpress

Displaying post titles from specific category in WordPress
Use WP-Query: <?php $args = array('cat'=>1); // The Query $query = new WP_Query( $args ); // The Loop if ( $query->have_posts() ) { while ( $query->have_posts() ) { $query->the_post(); echo '<li>' . get_the_title() . '</li>'; echo '<li>' . the_permalink() . '</li>'; echo '<li>' . the_excerpt() . '</li>'; } } else { // no posts found } /* Restore original Post Data */ wp_reset_postdata(); It will list all posts of category 1, with title, permalink, and excerpt More info: wp_query

Categories : Wordpress

WordPress: How do I show the parent category in the post meta?
Try this: (taken from this post: Wordpress function to get top level category of a post?): put this in your functions.php file at the bottom before the closing ?> tag function get_top_category() { $cats = get_the_category(); // category object $top_cat_obj = array(); foreach($cats as $cat) { if ($cat->parent == 0) { $top_cat_obj[] = $cat; } } $top_cat_obj = $top_cat_obj[0]; return $top_cat_obj; } Amend your content.php: <?php $top_cat = get_top_category();?> <?php printf( __( 'Posted in %1$s', 'underground_sound' ), $top_cat->slug .' - '.$categories_list ); ?>

Categories : Wordpress

I need to show recent two wordpress posts in my codeigniter site at home page
You may try this define('WP_USE_THEMES', false); require('blog/wp-load.php'); $postslist = get_posts( array( 'posts_per_page' => 2, 'orderby'=> 'post_date' ) ); foreach( $postslist as $post ) : setup_postdata($post); ?> <div class="events"> <p><strong><?php the_date(); ?></strong></p> <p><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></p> </div> <?php endforeach; ?>

Categories : PHP

How to show 3 most recent posts in a special tiles on home page using wordpress?
Here is one way to do it. If you're new you should read up on these essential topics: The Loop and WP_Query. <?php $query = new WP_Query( 'posts_per_page=3' ); // The Loop if ( $query->have_posts() ) { $i = 1; while ( $query->have_posts() ) { $query->the_post(); $i++; ?> <div class="tile<?php echo $i ?>"> <img class="post-image" src="<?php echo get_post_meta($post->ID, 'post_image', true) ?>"/> <div class="tile-datebox"> <img src="<?php echo get_post_meta($post->ID, 'post_icon', true) ?>" > <p><?php the_time('F jS, Y') ?></p> <div class="tile-info"><h1><a href="<?php the_per

Categories : PHP

Show different footer if the total amount of published posts is greater than one in Wordpress?
= performs an assignment, so this: if($count_posts = 1){ ... is basically the same as this: $count_posts = 1; if($count_posts) { Most likely you wanted to do a comparison instead of an assignment: if($count_posts == 1){

Categories : PHP

Post only one specific category on the index page of my wordpress blog
You need to add specific query in your page This is sample query code <?php $args = array( 'category_name' => 'Highlights', 'orderby' => 'post_date', 'order' => 'DESC', 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => 5, 'caller_get_posts'=> 1 ); $my_query = null; $my_query = new WP_Query($args); if( $my_query->have_posts() ) { while ($my_query->have_posts()) : $my_query->the_post(); ?> <?php the_title(); ?> <?php the_excerpt(); ?> <?php endwhile; } else { ?> <p>There is no post in this category</p> <?php } wp_reset_query(); } ?> I hope you find your solution here. If you have any question, then ask me on this website abdul.thinkbeyo

Categories : Wordpress

how to show one artical from a category and rest of articals as an archive in wordpress
This is not a function I've used before but looks like it should do what you need: http://codex.wordpress.org/Function_Reference/wp_get_recent_posts Just change the posts_per_page to 1. (EDIT: And also change the category to the ID of your newsletter category)

Categories : Wordpress

Show the category and the list of all subcategories in wordpress sidebar of a post
$q_cat = get_query_var('cat'); $cat = get_category($q_cat); $catname = $cat->cat_name; echo $catname; $childcategories = get_categories('child_of='.$cat->cat_ID); foreach($childcategories as $ccat){ echo $ccat->cat_name; or no echo try with $output =''; <-- your html code return $output;

Categories : Wordpress

Wordpress Loop - Show posts from custom taxonomy terms in heirarchical order
Posts ordered in admin page by "menu_order"; If u want to order posts using query_posts (WP_Query constructor) u should use value of variable "orderby" in upper case -> "ID".

Categories : PHP

posts_per_page plus show specific number per category
This loop is actually doing what I want it to do already. Using the foreach loop it is iterating a loop for each category, and the posts_per_page is working for each loop inside the foreach loop. Hopefully that makes sense.

Categories : Wordpress

Eloquent query in Laravel 4 how to show single post with comments from specific category
Just make a function and pass in the post number as $id, or whatever. Im just naming the function news here and passing the $id, but yours will be different cuz I don't know your controller / page structure....but its along these lines. public function news($id){ $posts = Category::find(1)->posts()->orderBy('created_at', 'desc')->where('hidden', '=', 0)->where('id','=',$id)->get(); print_r($posts); } Now it will find that specific post in that category 1......if the post doesn't exist in the category, it shouldn't return anything. So if you go to news/1 it will show, and if you go to news/2 nothing will show, because the Category still stayed at (1)

Categories : Laravel

How to make Wordpress Category menu items display the category as title?
You can look at the category slug in the URL, and get the category by its slug. $cat = get_category_by_slug( $slug ); echo $cat->name; http://codex.wordpress.org/Function_Reference/get_category_by_slug

Categories : Wordpress

Wordpress - Show parent category AND subcategory name in subcategory archive URL
Setting Settings->Permalinks->Category base to '%category%' should give you what you want. According to WP doc: Nested sub-categories appear as nested directories in the URI See http://codex.wordpress.org/Using_Permalinks.

Categories : Wordpress



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.