Custom taxonomy loop not returning anythig - wordpress

I've set up a custom taxonomy (menu_category) and custom post type (menu_item) in functions.php like this:
/* Set up custom post type for Menu Items */
function create_menu_items_post_type() {
$plugin_directory = plugins_url('images/', __FILE__ );
register_post_type( 'menu_item',
array(
'labels' => array(
'singular_name' => __( 'Menu item'),
'name' => __( 'The Menu'),
'add_new' => __( 'Add menu item'),
'add_new_item' => __( 'Add menu item'),
'edit_item' => __( 'Edit menu item'),
'new_item' => __( 'New menu item'),
'search_items' => __( 'Search menu items'),
'not_found' => __( 'No menu items found'),
'not_found_in_trash'=> __( 'No menu items found in trash'),
'all_items' => __( 'All menu items','sbr')
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'menu_item'),
'publicly_queryable' => true,
'hierarchical' => true,
'show_ui' => true,
'show_in_menu' => true,
'exclude_from_search' => true,
'query_var' => true,
'menu_position' => 27,
'can_export' => true,
'menu_icon' => get_template_directory_uri() . '/images/system/menu.svg',
'supports' => array('title', 'revisions', 'author'),
'capability_type' => 'post',
'taxonomies' => array('menu_category'),
'capabilities' => array(
'create_posts' => 'edit_posts',
),
'map_meta_cap' => true,
)
);
}
add_action( 'init', 'create_menu_items_post_type' );
/* Set up custom taxonomy for Menu Categories */
function create_menu_category_taxonomy() {
$labels = array(
'name' => _x( 'Menu categories', 'taxonomy general name' ),
'singular_name' => _x( 'Menu category', 'taxonomy singular name' ),
'search_items' => __( 'Search menu categories' ),
'all_items' => __( 'All menu categories' ),
'parent_item' => __( 'Parent menu categories' ),
'parent_item_colon' => __( 'Parent menu categories:' ),
'edit_item' => __( 'Edit menu category' ),
'update_item' => __( 'Update menu category' ),
'add_new_item' => __( 'Add new menu category' ),
'new_item_name' => __( 'New menu category' ),
'menu_name' => __( 'Menu categories' ),
);
register_taxonomy(
'menu_category',
'menu_item',
array(
'label' => __( 'Menu Category' ),
'rewrite' => array( 'slug' => 'menu_category' ),
'hierarchical' => true,
'labels' => $labels
)
);
}
add_action( 'init', 'create_menu_category_taxonomy' );
...and that works fine when I'm in WP admin - I can add new categories, posts etc.
But on the front-end I'm trying to return a list of all the menu_category categories and menu_item posts like this:
$the_menus = get_categories(array(
'echo' => 0,
'hide_empty' => false,
'taxonomy' => 'menu_category',
'hierarchical' => 1,
'show_count' => 0
)); ?>
<?php
foreach ($the_menus as $the_menu) {
$the_menu_args = array(
'posts_per_page' => -1,
'post_type' => 'menu_item',
'showposts' => -1,
'post_status' => 'publish',
'cat' => $the_menu->cat_ID
);
$term = get_queried_object();
$the_menu_tasks = new WP_Query($the_menu_args);
$the_menu_slug = $the_menu->slug;
$the_menu_ID = $the_menu->cat_ID;
$page_slug = $term->slug;
?>
<li>
<a href="<?php echo get_category_link( $the_menu_ID ); ?>">
<?php echo $the_menu->cat_name; ?>
</a>
</li>
<?php
}
wp_reset_postdata();
The problem is this loop returns nothing.
If I remove 'taxonomy' => 'menu_category' from $the_menus and also remove 'post_type' => 'menu_item' from $the_menu_args, it returns all the normal categories and posts (you know, regular posts and categories).
So it seems it's only failing when I specify the custom taxonomy and custom post type.
What am I doing wrong?
PS: The 'menu items' mentioned here are for a restaurant menu I'm trying to build. It has nothing to do with the WordPress menu :-P

To get the posts from custom taxonomy we need to pass tax query in arguments.
Try the below code. It works fine on my end.
<?php
$the_menus = get_terms( array(
'taxonomy' => 'menu_category',
'hide_empty' => false,
));
foreach ($the_menus as $the_menu) {
$args = array(
'post_type' => 'menu_item',
'posts_per_page' => -1,
'post_status' => 'publish',
'tax_query' => array(
array (
'taxonomy' => 'menu_category',
'field' => 'term_id',
'terms' => $the_menu->term_id,
)
),
);
$term = get_queried_object();
$the_menu_tasks = new WP_Query($args);
$the_menu_slug = $the_menu->slug;
$the_menu_ID = $the_menu->term_id;
$page_slug = $term->slug;
?>
<!-- get category names here -->
<li>
<a href="<?php echo get_term_link( $the_menu_ID ); ?>">
<?php echo $the_menu->name; ?>
</a>
</li>
<!-- get category names here //END -->
<?php
/* GET posts according to custom taxonomy id */
if ($the_menu_tasks->have_posts()){
while($the_menu_tasks->have_posts()) : $the_menu_tasks->the_post();
echo get_the_title() .'<br />';
endwhile;
}else{
echo "Sorry! Posts not found";
}
/* GET posts according to custom taxonomy id -- END */
}
?>

Related

In Wordpress display custom post type single page display previous and next links for custom category

I have created a custom post type that has the ability to have custom taxonomies.
On the Single of the custom post type, I would like to be able to include "previous post" and "next post" buttons which display only if there are previous and next posts.
Set up for the custom post type in functions.php:
function the_custom_post_types() {
$types = array(
// Gallery
array(
'the_type' => 'gallery', // becomes the archive url and used in archive template name (archive-{the_type}.php)
'single' => 'single',
'plural' => 'plural',
'display' => 'Gallery',
'icon' => 'dashicons-art',
'show_in_rest' => false,
'supports' => array( 'title', 'editor', 'custom-fields', 'post_tag', 'collection', 'thumbnail' ),
'taxonomies' => array( 'collection' ),
),
// ... other CPTs ...
);
foreach ($types as $type) {
$the_type = $type['the_type'];
$single = $type['single'];
$plural = $type['plural'];
$display = $type['display'];
$icon = $type['icon'];
$gutenburg = $type['show_in_rest'];
$supports = $type['supports'];
$taxonomies = $type['taxonomies'];
$labels = array(
'name' => _x($display, 'post type general name'),
'singular_name' => _x($single, 'post type singular name'),
'add_new' => _x('Add New', $single),
'add_new_item' => __('Add New '. $single),
'edit_item' => __('Edit '.$single),
'new_item' => __('New '.$single),
'view_item' => __('View all '.$single),
'search_items' => __('Search all'.$plural),
'not_found'. => __('No '.$plural.' found'),
'not_found_in_trash' => __('No '.$plural.' found in Trash'),
'parent_item_colon' => ''
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => true,
'show_in_rest' => $gutenburg,
'menu_position' => 21,
'supports' => $supports,
'menu_icon' => $icon,
'taxonomies' => $taxonomies
);
register_post_type($the_type, $args);
flush_rewrite_rules();
}
}
add_action('init', 'the_custom_post_types');
And the taxonomy is created in a similar fashion like so:
function scaffolding_custom_taxonomies() {
$types = array(
array(
'the_type' => 'collection',
'single' => 'Collection',
'plural' => 'Collections',
'display' => 'Collections',
'post_types' => array( 'gallery' )
)
);
foreach ($types as $type) {
$the_type = $type['the_type'];
$single = $type['single'];
$plural = $type['plural'];
$display = $type['display'];
$post_types = $type['post_types'];
$labels = array(
'name' => _x( $display, 'taxonomy general name' ),
'singular_name' => _x( $single, 'taxonomy singular name' ),
'search_items' => __( 'Search ' . $plural ),
'all_items' => __( 'All ' . $plural ),
'parent_item' => __( 'Parent ' . $single ),
'parent_item_colon' => __( 'Parent ' . $single . ':' ),
'edit_item' => __( 'Edit ' . $single ),
'update_item' => __( 'Update ' . $single ),
'add_new_item' => __( 'Add New ' . $single ),
'new_item_name' => __( 'New ' . $single . ' Name' ),
'menu_name' => __( $plural ),
);
$rewrite = array(
'slug' => $the_type
);
$args = array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => $rewrite
);
register_taxonomy( $the_type, $post_types, $args);
flush_rewrite_rules();
}
}
add_action( 'init', 'scaffolding_custom_taxonomies', 0 );
Currently, I have used the code below for the single page.
<nav class="artwork__pagination">
<div class="artwork__prev"><?php previous_post_link( '%link', 'previous' ); ?></div>
<div class="artwork__next"><?php next_post_link( '%link', 'next' ); ?></div>
</nav>
This cycles through all the posts in the CPT rather than just those in the current category.
If I include 'true' to the array like so:
<nav class="artwork__pagination">
<div class="artwork__prev"><?php previous_post_link( '%link', 'previous', true ); ?></div>
<div class="artwork__next"><?php next_post_link( '%link', 'next', true ); ?></div>
</nav>
It returns nothing.
How can I get the links to display and limit them to only those within the same custom category?
The next and prev post link function includes a param for taxonomy, where the default is category. Since your taxonomy is named collection this should work.
/*
* The parameters for next/previous post as defined in the function.
* #param string $format Optional. Link anchor format. Default '« %link'.
* #param string $link Optional. Link permalink format. Default '%title'.
* #param bool $in_same_term Optional. Whether link should be in a same taxonomy term. Default false.
* #param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty.
* #param string $taxonomy Optional. Taxonomy, if $in_same_term is true. Default 'category'.
*/
?>
<nav class="artwork__pagination">
<div class="artwork__prev"><?php previous_post_link( '%link', 'previous', true, '', 'collection' ); ?></div>
<div class="artwork__next"><?php next_post_link( '%link', 'next', true, '', 'collection' ); ?></div>
</nav>

How to display the taxonomy of the Custom Post Type?

Here we register the Spotlights CPT and the taxonomy of the CPT
<?php
/*
* Register Spotlight CPT
*/
add_action( 'init', 'register_spotlights', 0 );
function register_spotlights() {
$spotlight_labels = array(
'name' => _x( 'Spotlights', 'Post Type General Name', '' ),
'singular_name' => _x( 'Spotlight', 'Post Type Singular Name', '' ),
'menu_name' => __( 'Spotlights', '' ),
'parent_item_colon' => __( 'Parent Item:' ),
'all_items' => __( 'All Spotlights', '' ),
'view_item' => __( 'View Spotlight', '' ),
'add_new_item' => __( 'Add New', '' ),
'add_new' => __( 'Add New', '' ),
'edit_item' => __( 'Edit Spotlight', '' ),
'update_item' => __( 'Update Spotlight', '' ),
'search_items' => __( 'Search Spotlight', '' ),
'not_found' => __( 'Not found', '' ),
'not_found_in_trash' => __( 'Not found in Trash', '' ),
);
$spotlight_args = array(
'label' => __( 'Spotlight', '' ),
'description' => __( 'Holds spotlights', '' ),
'labels' => $spotlight_labels,
'supports' => array( 'title', 'thumbnail', 'custom-fields'),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 6,
'menu_icon' => 'dashicons-admin-post',
'can_export' => true,
'has_archive' => false,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
'rewrite' => array( 'slug' => 'spotlight', 'with_front' => false),
);
register_taxonomy(
'category-spotlight',
'spotlight',
array(
'hierarchical' => true,
'labels' => array(
'name' => 'Category',
'singular_name' => 'Category'
),
'show_ui' => true,
'show_admin_column' => true,
'public' => false,
'query_var' => false,
'show_in_rest' => true,
'rewrite' => false
)
);
register_post_type( 'spotlight', $spotlight_args);
}
Here is the loop where we add the CPT, how do we display the taxonomy category here?
<?php
$args = array(
'post_type' => 'spotlight',
'orderby' => 'date',
'order' => 'DESC',
'posts_per_page' => 2
);
$query = new WP_Query( $args );
$taxonomy = 'category-spotlight';
$terms = get_terms($taxonomy); // Get all terms of a taxonomy
if ($query->have_posts()): ?>
<?php while ($query->have_posts()): $query->the_post(); ?>
<div class="category"><?php echo $terms->name; ?></div>
<h3 class="small"><?php the_title(); ?></h2>
<?php endwhile; ?>
<?php endif; ?>
I want to display something like:
Title1
Category1
Title2
Category2
Currently the title for each post is displayed, but not the taxonomy for each post.
How do display the taxonomy under each title?
According to the documentation, get_terms will return an array of WP_Term objects or WP_Error. In your code, you have $terms->name. You'll need to either have it select the first term found in which case you'll need $terms[0]->name, or you'll need to add some logic to get the correct term you want to display.
Additionally, the terms you are loading are not necessarily related to the post. If you want to load the terms used for the post, you'll need to call get_the_terms($post, $taxonomy) to get the associated taxonomy term(s) with the associated post. Once again, it'll be a return type of an array, so make sure to extract the correct value.
Replace your code with this. i hope this work for you.
<?php
if ($query->have_posts()): ?>
<?php while ($query->have_posts()): $query->the_post(); ?>
<div class="category"><?php echo $terms->name; ?></div>
<h3 class="small"><?php the_title(); ?></h2>
<?php
$category_spotlight = get_the_terms( get_the_ID() , 'category-spotlight' );
foreach( $category_spotlight as $category_spot ) {
echo $category_spot->name;
}
?>
<?php endwhile; ?>
<?php endif; ?>

Custom Post Type Taxonomy remove category slug

I have created a custom post type 'Shop' with a custom taxonomy for Shop Categories
For my shop category archive pages I want the URL structure to be:
example.com/shop/tech/ (instead of example.com/shop/category/tech/)
And I want Shop posts to be example.com/shop/shop-post-title-example
I have tried the code below and saved permalinks but when I visit a Shop post it shows a 404 error.
Is it possible to remove the category base without errors?
// Custom Post Type : Shop
function my_custom_post_shop() {
$labels = array(
'name' => _x( 'Shop', 'post type general name' ),
'singular_name' => _x( 'Product', 'post type singular name' ),
'add_new' => _x( 'Add New', 'Product' ),
'add_new_item' => __( 'Add New' ),
'edit_item' => __( 'Edit' ),
'new_item' => __( 'New Product' ),
'all_items' => __( 'All Products' ),
'view_item' => __( 'View Product' ),
'search_items' => __( 'Search Products' ),
'not_found' => __( 'No projects found' ),
'not_found_in_trash' => __( 'No projects found in the Trash' ),
'menu_name' => 'Shop'
);
$args = array(
'label' => __( 'Shop' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'comments', 'revisions', 'custom-fields', 'thumbnail', ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'can_export' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'post',
'rewrite' => array( 'slug' => 'shop' ),
'has_archive' => 'shop',
);
register_post_type( 'shop', $args );
}
add_action( 'init', 'my_custom_post_shop' );
// Shop Categories
function my_taxonomies_shop() {
$labels = array(
'name' => _x( 'Shop Categories', 'taxonomy general name' ),
'singular_name' => _x( 'Shop Category', 'taxonomy singular name' ),
'search_items' => __( 'Search Categories' ),
'all_items' => __( 'All Categories' ),
'parent_item' => __( 'Parent Category' ),
'parent_item_colon' => __( 'Parent Category:' ),
'edit_item' => __( 'Edit Category' ),
'update_item' => __( 'Update Category' ),
'add_new_item' => __( 'Add New Category' ),
'new_item_name' => __( 'New Category' ),
'menu_name' => __( 'Shop Categories' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
'show_admin_column' => true,
'rewrite' => array( 'slug' => 'shop'),
);
register_taxonomy( 'shop_category', 'shop', $args );
}
add_action( 'init', 'my_taxonomies_shop', 0 );
You can remove the category base in custom taxonomy URLs with:
$args = array(
'rewrite' => array( 'slug' => '/', 'with_front' => false),
/* ...(other args)... */
);
register_taxonomy( 'shop_category', 'shop', $args );
And re-save Permalinks settings.
However, this will make your (basic post type) posts go 404, if you have permalinks set to Post name. It seems you cannot have both custom taxonomy and posts reside in the root. Therefore you would go to Permalinks settings and set Custom structure , e.g. /blog/%postname%/.
A side effect is that your CPTs would have this "front", too, e.g. blog/yourcustomtype. You can get rid of this with 'with_front' => false in your product type registration:
register_post_type( 'yourcustomtype', array(
'rewrite' => array(
'slug' => 'yourcustomurl',
'with_front' => false
),
/* ... */
));
Found here.
As far as I know, in order to display custom post type and/or its category page, you would need to create template files (corresponding PHP files) first. Template files would pull your posts and display them.
For example, to display your categories "shop_category" you could create a file called "taxonomy-shop_category.php".
If you like to create a template specifically for "tech" Shop Category, then you can create a file called "taxonomy-shop_category_tech.php".
There is a hierarchy of templates: https://wphierarchy.com/
Also more about templates: https://developer.wordpress.org/themes/template-files-section/taxonomy-templates/
Nice article about custom post types taxonomies: https://code.tutsplus.com/tutorials/taxonomy-archives-list-posts-by-post-type--cms-20340
Template files should be placed in your WordPress theme folder (or child theme folder)
!important. Don't forget to update your permalinks. Go to /wp-admin/options-permalink.php and click "Save Changes".
Here is an example of a simple template file:
<?php
if ( ! defined( 'ABSPATH' ) ) { exit; }
?>
<?php get_header();
$term = get_queried_object();
$args = array(
'post_type' => 'shop',
'shop-category' => $term->slug
);
$query = new WP_Query( $args );
?>
<header class="archive-header">
<h1 class="archive-title">
<?php echo $term->name; ?>
</h1>
</header>
<div id="content">
<?php
if ($query->have_posts()) {
echo'<h2>Your shop category name ' . $term->name . '</h2>';
echo '<ul>';
while ( $query->have_posts() ) : $query->the_post(); ?>
<li id="post-<?php the_ID(); ?>">
<?php the_title(); ?>
</li>
<?php endwhile;
echo '</ul>';
}
wp_reset_postdata();
?>
</div><!-- #content -->
<?php
get_footer();

Custom post type title of each author in his own post

The users registered in wordpress have one post only, and i created custom_post_type named "ofertas". The users can create one oferta only. With this code show the oferta title on index.php, the problem is show the oferta title in ALL POSTS. I want only show his own oferta title (if they have).
<?php
// First loop
while ( have_posts() ): the_post();
author_id = get_query_var('author');
$ofertas = array();
// Second Loop
$i = 0;
$args = array(
'author' => $author_id,
'post_type' => 'ofertas'
);
$the_query = new WP_Query( $args );
if ($the_query->have_posts()) :
while ($the_query->have_posts()) : $the_query->the_post(); // check if it has offers, if it has, loop over the offers
$ofertas[$i]['title'] = get_the_title(); // or anything you need
$i++;
endwhile; // close the loop
else: // if it has no post
continue; // we don't display the post
endif;
wp_reset_postdata();
?>
<div class="post">
<?php
the_title(); // or anything you need
foreach ($ofertas as $oferta):
echo $oferta['title']; // we display the title of the offer
endforeach;
?>
</div>
<?php endwhile; ?>
I created the custom_post_type with this code
add_action('init', 'crear_tipo_ofertas', 0);
function crear_tipo_ofertas() {
$labels = array(
'name' => _x( 'Ofertas', 'Post Type General Name', 'text_domain' ),
'singular_name' => _x( 'Oferta', 'Post Type Singular Name', 'text_domain' ),
'menu_name' => __( 'Ofertas', 'text_domain' ),
'parent_item_colon' => __( 'Oferta Padre', 'text_domain' ),
'all_items' => __( 'Ofertas', 'text_domain' ),
'view_item' => __( 'Ver Oferta', 'text_domain' ),
'add_new_item' => __( 'Añadir Oferta Nueva', 'text_domain' ),
'add_new' => __( 'Añadir', 'text_domain' ),
'edit_item' => __( 'Editar Oferta', 'text_domain' ),
'update_item' => __( 'Actualizar', 'text_domain' ),
'search_items' => __( 'Buscar Ofertas', 'text_domain' ),
'not_found' => __( 'Ofertas no encontradas', 'text_domain' ),
'not_found_in_trash' => __( 'Ofertas no encontradas en Papelera', 'text_domain' ),
);
$rewrite = array(
'slug' => 'oferta',
'with_front' => true,
'pages' => true,
'feeds' => true,
);
$args = array(
'label' => __( 'oferta', 'text_domain' ),
'description' => __( 'Ofertas Spas y Balnearios', 'text_domain' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'comments', 'thumbnail', 'custom-fields'),
'taxonomies' => array( 'category', 'post_tag' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'menu_icon' => site_url().'/wp-content/plugins/my_plugin/images/logo.png',
'can_export' => true,
'has_archive' => 'ofertas',
'exclude_from_search' => false,
'query_var' => 'ofertas',
'rewrite' => $rewrite,
'capability_type' => 'post',
);
register_post_type('ofertas', $args);
}
add_action('init', 'crear_tipo_ofertas', 0);
If I understand you correctly, you want to show the current logged in users posts in the ofertas CPT? Try changing this line:
author_id = get_query_var('author');
To this:
$author_id = get_current_user_id();
get_query_var('author) is used to retrieve a public query variable which is most likely not set on the home page.

Wordpress pagination for custom post type not working

I have created custom post type with custom taxanomy and displaying them on theme's index.php. when i use wordpress pagination, and it goes on page 2, nothing showing there and it goes on Page Not Found!.
following are codes
add_action( 'init', 'register_success_stories' );
function register_success_stories(){
register_post_type( 'sajid-photos', array(
'label' => 'My Photos',
'singular_label' => 'My Photo',
'description' => 'Manage phots.',
'public' => TRUE,
'publicly_queryable' => TRUE,
'show_ui' => TRUE,
'query_var' => TRUE,
'rewrite' => TRUE,
'capability_type' => 'post',
'hierarchical' => FALSE,
'menu_position' => NULL,
'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments', 'custom-fields', 'revisions'),
'menu_position' => 5,
'rewrite' => array(
'slug' => 'sajid-photo-work',
'with_front' => FALSE,
),
'labels' => array(
'name' => __( 'My Photos' ),
'singular_name' => __( 'My Photos' ),
'add_new' => __( 'Add New Photo' ),
'add_new_item' => __( 'Add New Photo' ),
'edit' => __( 'Edit Photo' ),
'edit_item' => __( 'Edit Photo' ),
'new_item' => __( 'New Photo' ),
'view' => __( 'View Photo' ),
'view_item' => __( 'View Photo' ),
'search_items' => __( 'Search Photos' ),
'not_found' => __( 'No Photo Found' ),
'not_found_in_trash' => __( 'No Photo found in Trash' ),
'parent' => __( 'Parent Photo' ),
)
));
flush_rewrite_rules( false );
}
register_taxonomy('sajid-album', 'sajid-photos', array(
'label' => 'Albums',
'singular_label' => 'Album',
'public' => TRUE,
'show_tagcloud' => FALSE,
'hierarchical' => TRUE,
'query_var' => TRUE,
'rewrite' => array('slug' => 'sajid-album' )
));
Following is code to show specific texanomy's post on home page.
<?php
wp_reset_query();
global $post;
query_posts( array( 'post_type' => 'sajid-photos', 'sajid-album' => 'home-page-photos','paged' => $paged, 'posts_per_page' => 1 , 'paged' => get_query_var('paged')) );
if ( have_posts() ){
while ( have_posts() ) : the_post();
unset($thumb_big);
$thumb_big = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' );
$thumb_big_url = $thumb_big['0'];
?>
<img src="<?php echo $cfs->get('upload_thumbnail'); ?>" alt="<?php the_title(); ?>">
<?php
endwhile;
} // end of if ( have_posts() )
theme_paginate();
wp_reset_query();
?>
Moreover its Terms urls also not working, when i click on term, it goes on page not found.
please help me to solve this problem.
thank you very much.
website URL is http://sajidz.w3made.com/
For starters, ideally you wouldn't paginate your homepage in a wordpress site. But per the documentation you would need to be looking for the get_query_var('page') variable instead of "paged" if you want to get the current page on a static front page. You are using theme_paginate(); it appears for pagination linking and I am not sure how it is building the links, so that might be the first place you start.

Resources