Post Loop not Returning Permalink

You have made the mistake in getting the post link in your code. Missing <?php global $post; ?> – Initialization at the start of the loop After setting up the post data your query becomes like normal Wp_Query so that you can get the permalink() in normal method itself using the_permalink() instead of get_permalink($post->id). Since … Read more

wp_insert_posts Fatal error: Maximum function nesting level of ‘100’ reached, aborting!

Fixed the problem I’ve added this line before the insertion of the posts. remove_action(‘save_post’, __FUNCTION__); final code: add_action(‘save_post’, ‘save_post_func’); function save_post_func(){ remove_action(‘save_post’, __FUNCTION__); include_once(ABSPATH . WPINC . ‘/feed.php’); $rss = fetch_feed($url); if (!is_wp_error($rss)) { $maxitems = $rss->get_item_quantity(5); $rss_items = $rss->get_items(0, $maxitems); foreach ($rss_items as $item) { wp_insert_post(array(‘post_title’ => ‘a’)); } } }

Custom Post Loop in Archive returns same the_permalink

This is an extention to your answer. Your pre_get_posts action has a few flaws function add_custom_types_to_tax( $query ) { if( is_category() || is_tag() && empty( $query->query_vars[‘suppress_filters’] ) ) { // Get all your post types $post_types = get_post_types(); $query->set( ‘post_type’, $post_types ); return $query; } } add_filter( ‘pre_get_posts’, ‘add_custom_types_to_tax’ ); is_category() and is_tag() should be … Read more

Post from one loop in different containers?

<?php $class=””; // set your class to nothing outside the loop ?> <?php if (have_posts()) : while ( have_posts()) : the_post(); ?> <?php $class = (‘first-container’ == $class) ? ‘second-container’ : ‘first-container’; // alternate classes ?> <div <?php post_class(‘clearfix’) ?> id=”post-<?php the_ID(); ?>”> <h2><a href=”https://wordpress.stackexchange.com/questions/77704/<?php the_permalink() ?>”><?php the_title(); ?></a></h2> <div class=”<?php echo $class ?>”> If … Read more

Looping through tabular data

The biggest problem here is syncing between two dissimilar sets of data. This looks like a good use-case for @scribu ‘s Posts2Posts plugin. Once you’ve installed that, you can create a direct correlation between the different post-types and query that connection.

Specific loop in Shortcode

Ok mate – i got you… you should really break into 2 shortcodes. One as a wrapper (which is really short) and the other for the content… Example: add_shortcode(‘servicewrap’, ‘service_wrapsc’); function service_wrapsc($atts, $content = null) { return ‘<div class=”service”><div class=”container”><div class=”row”>’.do_shortcode($content).'</div></div></div>’; } add_shortcode(‘servicesingle’, ‘service_singlesc’); function service_singlesc($atts, $content = null) { extract(shortcode_atts(array( ‘icon’ => ‘fa-briefcase’ ), … Read more

Calling Specific Pages with wp query Part II

Two issues here The default page post type is page, not pages Your meta_query is wrong, it should be an array of an array, not just an array Your arguments should be $args = array( ‘post_type’ => ‘page’, ‘order’ => ‘ASC’, ‘posts_per_page’ => 50, ‘meta_query’ => array( array( ‘key’ => ‘field_5505a81b83234’, // field key generated … Read more

How to create posts (not post template) to be displayed on projects page?

The best way is to register a custom post type then loop through that type within your projects page template. CPT from GenerateWP. if ( ! function_exists(‘projects’) ) { // Register Custom Post Type function projects() { $labels = array( ‘name’ => _x( ‘Projects’, ‘Post Type General Name’, ‘text_domain’ ), ‘singular_name’ => _x( ‘Project’, ‘Post … Read more

Landing Page – Redirect Loop?

What’s happening is you’re sending an unauthenticated visitor to a certain page. The code in that page also picks up that the user is unauthenticated, and sends them to the page that they’re already on. Because the page keeps on sending the visitor to the same page, the visitor can’t go anywhere. This is called … Read more

“Blog pages show at most” in The Loop

The only reasonable guesses that come to my mind are that the theme (or a plugin): Modifies the main Query with a filter on pre_get_posts, so look for that filter. Just creates a new Loop with new WP_Query($args). You will have to dig through the template file to find out. Interrupts the post_per_page save process … Read more