blk784
Forum Replies Created
-
I used the following:
if(function_exists('genarate_ajax_pagination')) { genarate_ajax_pagination('Load More', 'blue', "content", array('post_type' => 'post')); }
and still get the same results, the button shows up, I click it, the little spinning circle appears beside the button, then it just adds a line above my button with no new posts.
I am using this in the custom community buddypress theme in the default index.php file, with no custom post query.Forum: Fixing WordPress
In reply to: add/remove filter for custom queryHere is the site and you will see the 3 filters on the right each one has a sort number and other than the homepage (which should default to $sort = 1) and these 3 menu items, any other page should load with the default query.
Forum: Fixing WordPress
In reply to: add/remove filter for custom queryStill not working! I have added this in each filter
if(is_front_page() && empty($sort)) { filter code executed; }
and these filters are at the bottom of my functions.php file. I also added this code to the top of my index.php file:
global $sort; $sort = 1;
so that on the first page request for the homepage the initial filter is fired. Also above the add_filter’s in my functions.php
I have:if(isset($_GET['sort'])){ $sort = $_GET['sort']; }
This should fire the filter if its the homepage or if the sort variable is populated in the $_GET array, otherwise it would be a normal page and the default query should run. When I click on posts that aren’t in my custom fitlers, I get a page not found message and in the wp-admin dashboard for all posts, only posts from the filters are returned which is not correct. I am so desperate for help! Please dont get frustrated with me, I just don’t know if I am adding the code in the right files.
Forum: Fixing WordPress
In reply to: add/remove filter for custom queryI have declared the global $sort inside my filters and check them inside the filters. How can I set it only if it is the homepage? any other page it can be empty and then the filters wont fire.
Forum: Fixing WordPress
In reply to: add/remove filter for custom queryI have set a global variable in the functions.php like so:
global $sort; if (! isset($_GET['sort']) && empty($sort)) { $sort = 1; } if (isset($_GET['sort'])) { $sort = $_GET['sort']; }
Then in the first line of my sidebar.php I set $sort = 0 so that the sort filters are not added if the sort is equal to 0. I have another code block that handles this in functions.php that looks like:
if ($sort == 1 || $sort == 2){ add_filter('posts_join', 'votes_join'); add_filter('posts_where', 'votes_where'); add_filter('posts_orderby', 'votes_orderby'); } if ($sort == 0) { remove_filter('posts_join'); remove_filter('posts_where'); remove_filter('posts_orderby'); }
Am I missing something? still doesn’t seem to work cause certain posts aren’t showing up in my admin menu, only those returned by by the filters.
Forum: Fixing WordPress
In reply to: is_home() is_front_page() not working in sidebar.phpI have used add_filter to customize the query in the functions.php within the theme folder. This gives me the custom query but I can’t seem to get functions like, remove_filter or wp_reset_query to work in the index.php. Also, I have tried wrapping the add_filter function with if(is_home) or if(is_front_page) so that only this custom query is used on the front page but it fails to give me the results I want as well. Where could I place this code so that it only applies my filter on the homepage?
Forum: Fixing WordPress
In reply to: Custom QueryI have a problem with the filters I have applied interfering with other pages not being found and also when logged in to the admin panel viewing all posts only gives me the posts that the custom query I have set up returns. How can I only apply the filters for the custom query for the homepage and homepage only and not all other areas of the site?
Forum: Fixing WordPress
In reply to: Custom QueryI ended up placing the code in the functions.php file in the theme folder I am using. Now my problem is that the search filters are causing other pages to not show up. I want to somehow set a flag if it is the home page so that the filters are added (if(is_home()) do->this) but the is_home and is_front_page functions don’t seem to be working in that functions.php file. I would like a get variable to be populated when the homepage is loaded and if it is set then I know to add the filters. Where can I put code to set a get variable on home page load?