Search Results for 'code'
-
Search Results
-
Topic: pagination in custom query
Hi Everyone,
i am make one function in function.php file in which i wrote my own query. now i want set pagination(bbpress pagination). i dont know about and any idea. please help me . below my function.
function best_conversationstarters(){ global $wpdb, $paged, $max_num_pages; $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $post_per_page = (intval(get_query_var('posts_per_page'))>0) ? intval(get_query_var('posts_per_page')) : 5; $offset = ($paged - 1)*$post_per_page; $best_conversation_starter = "SELECT COUNT(*) topic, post_author FROM {$wpdb->posts} WHERE {$wpdb->posts}.post_type LIKE '%topic%' GROUP BY post_author ORDER BY topic DESC LIMIT ".$offset.", ".$post_per_page; $sql_result = $wpdb->get_results( $best_conversation_starter, OBJECT); /* Determine the total of results found to calculate the max_num_pages for next_posts_link navigation */ $sql_posts_total = $wpdb->get_var( "SELECT FOUND_ROWS();" ); $max_num_pages = ceil($sql_posts_total / $post_per_page); return $sql_result; }thanks.
Topic: Breadcrumb Problem
I have the latest WP installed with OptimizePress 2, Buddy Press and BBpress (latest versions) installed. I am building the forums in the private section of a membership site.
I am having issues with the Breadcrumb links.
I used method 2, a page for the forums index with short code. The forums display properly.
>> http://www.imstudy.club/forums-welcome/Then when I click on each forum it goes to the correct page, I have set-up “Content Aware Sidebars” to show widgets in the sidebar and the forums in the content area. It works.
Now when I am on one of these forums the breadcrumb shows:
IM Study Club’s Public Home › Forums › Site FeedbackThe link “Forums”, is the Forum root and it goes here:
http://www.imstudy.club/forums/That’s a Blog Archives page with a link “continue reading” going nowhere.
How can I have this “Forums” link in the breadcrumb go to my custom page “forums-welcome” instead.
I have tried to change the name of the root forum to match the page, but it doesn’t works, always get the blog archives page… I also tried to redirect, but got a loop.
Any idea?
Thank you very much for your help.
Michel
Hi All,
I would like to create a link in a wordpress widget that redirects the logged in user to his user forum profile page but I cannot manage… I dont know what code should I use.
Example : it should redirects to the page : http://www.example.org/forums/user/admin/
Thanks in advance
Regards,
Topic: Shortcode for user profile
Hi,
is there a short code to display the users profile?
After reading the documentation and working with bbpress the only way a user can see their profile is if they have already created a topic or replied to a topic.
Some users only want to favorite a few topics. However they can not see their favorites unless they can see their user profile.
Included is a screen shot of what is wanted.
https://www.dropbox.com/s/qtwtvfwckswjfk9/profile_shortcode.jpg?dl=0Thanks,
KevinTopic: Broken Breadcrumbs
WordPress 3.9.2 running Montezuma theme.
bbPress 2.5.4
There is no “Forums” landing page and the breadcrumbs don’t work for either forums or topics. You can see the individual forums from inside the admin and clicking view and then post a topic but you can’t see the forum from the public face of the blog. Follow the link and you’ll see what I mean.
http://ecopsi.org/forums/topic/the-codex-of-aman/Very frustrating. Is there something that I forget to do?
Topic: Get User Role from ID
I’m trying to add a column to bbPress 2.x that lists the last person to reply to a topic and adds a specific class to the
if that person is a moderator or keymaster. Unfortunately, I can’t find any documentation on the template tags in 2.x. So far, I’ve been able to get the user ID for the last reply, but I can’t seem to find the function that would get the role information for that user based on their ID.
Here’s the code that gets the ID:$reply_author_id = bbp_get_reply_author_id( array( 'post_id' => bbp_get_topic_last_active_id() ) );Now how can I get their bbPress role?
I’m having trouble outputting specific topic counts for individual forums into Google’s Geochart. I want to have the total topic count listed on the map for each region (each forum). I use the following code to try and print the value, but I know I’m missing something (limited PHP/Javascript experience). Please take a look below, what do I need to add in order to get the value to output?
<?php function my_geochart_script() { echo '<script type="text/javascript"> google.load("visualization", "1", {"packages": ["geochart"]}); google.setOnLoadCallback(drawRegionsMap); function drawRegionsMap() { var data = google.visualization.arrayToDataTable([ ["Country", "Popularity"], ["Canada", <?php bbp_forum_topic_count( '23196' ); ?>], ["Japan", <?php bbp_forum_topic_count( '23190' ); ?>], ]); var options = {backgroundColor:{fill:"transparent"}}; var chart = new google.visualization.GeoChart(document.getElementById("chart_div")); chart.draw(data, options); }; </script>'; } add_action( 'wp_head', 'my_geochart_script' );Any help would be much much appreciated! Thank you.