redirecting to a page within wordpress functions
-
The idea is to redirect to another page that will have the detail shortcode in it with sidebar which is not wanted in the list page.
I get ‘The page isnt redirecting properly Firefox has detected that the server is redirecting the request for this address in a way that will never complete.’As far as I have read wp_redirect is the correct way in wordpress and I have no idea why it isnt working.
[php] function get_list(){ global $post; // required if (isset($_POST['get_detail'])){ $ID = $_POST['get_detail']; call_user_func('get_itemdetail', '$ID'); } else { $args = array('post_type' => 'cat'); $custom_posts = get_posts($args); foreach($custom_posts as $post) : setup_postdata($post); $this_post = $post->ID; ?> <form action="." method="post" name="get_detail"><input type="hidden" id="" name="get_detail" value="<?php echo($this_post); ?>"><input value="View Detail" type="submit"></form> <?php endforeach; } // end if is set } add_shortcode ('list', 'get_list'); function get_itemdetail(){ wp_redirect( '/detail-page/' ); exit; global $post; // required $args = array('p' => $ID, 'post_type' => 'cat'); $loop = new WP_Query($args); while ( $loop->have_posts() ) : $loop->the_post(); ...... endwhile; } add_shortcode ('detail', 'get_itemdetail') [/php]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘redirecting to a page within wordpress functions’ is closed to new replies.