Gustav
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: Click author show all posts?This was the solution:
<a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>"><?php the_author(); ?></a>
Forum: Developing with WordPress
In reply to: Manipulating comments section what file?Found the file.
Its in /wp-includes
class-walker-comment.phpForum: Everything else WordPress
In reply to: Author post count from specific categorySolved.
$user_id = get_the_author_meta('ID'); $args = array( 'author' => $user_id, 'category_name' => 'category_slug_name', ); $my_query = new WP_Query( $args ); $my_count = $my_query->post_count; echo $my_count;
Forum: Everything else WordPress
In reply to: Author post count from specific categoryOk so this code works now but why does it prints all posts in that category and never ends printing?
<?php $user_id = get_the_author_meta('ID'); $args = array( 'author' => $user_id, 'category_name' => 'category-slug', ); $wp_query = new WP_Query($args); $posts = $wp_query->get_posts(); $my_count = count( $posts ); echo $my_count; ?>
Forum: Developing with WordPress
In reply to: Manipulating comments section what file?My theme just have this part “allmost” in comments.php
So i think comments section my be in some other file in wordpress but where?<?php the_comments_navigation(); ?> <ol class="comment-list"> <?php wp_list_comments( array( 'style' => 'ol', 'short_ping' => true, 'avatar_size' => 56, ) ); ?> </ol><!-- .comment-list -->
Forum: Everything else WordPress
In reply to: Author post count from specific categorySo i got this code but it prints result 0 why?
$user_id = get_the_author_meta('ID'); $args = array( 'author_name' => $user_id, 'category_name' => 'categoryname', ); $wp_query = new WP_Query($args); $posts = $wp_query->get_posts(); $my_count = count( $posts ); echo $my_count;
Forum: Developing with WordPress
In reply to: If post by specific role different style or cssWill try. I will comeback if i run into issues.
Forum: Developing with WordPress
In reply to: Is post by current userIm writing from cellphone so cant post what i got but.
Get current user id and then compare it with post author id?
But can’t author id and current user id be be identical to 2 different users?
But yes i get the point now. I will try to make a code later.
I comeback when im done with it and see if i need anymore help or just post the code so anyone can use it cause i tryied google can’t find complete code for this function.
Forum: Developing with WordPress
In reply to: Is post by current userYes i know those stuff i need more complete code or easier explenatioon.
Forum: Everything else WordPress
In reply to: Manually install plugin errorWell the back end had everything i neede anyways and can be modified.
Solved.
Forum: Everything else WordPress
In reply to: Manually install plugin errorPlugin is working but i cant see the plugin menu in dashboard. Does anyone know what the problem can be?
Forum: Developing with WordPress
In reply to: User can visit specific page only 1 time per monthThanks! Super!
I did it like this. Before you answered. Works also!Complete code for anyone who wants to use it!
<?php $user_id = get_current_user_id(); $args=array( 'post_type' => 'post', 'post_status' => 'published', 'posts_per_page' => 1, 'ignore_sticky_posts' => 1, 'author' => $user_id ); $wp_query = new WP_Query($args); while ( $wp_query->have_posts() ) : $wp_query->the_post(); ///////////////////////////////////////////////////////////////////////////////////////////////////////// $time = get_the_time('Y-m-d H:i:s', $post->ID); $date = new DateTime( $time ); $date2 = new DateTime( 'now' ); $diffInSeconds = $date2->getTimestamp() - $date->getTimestamp(); echo $diffInSeconds; echo "</br>"; if ($diffInSeconds >= 1 && $diffInSeconds <= 3000) { echo "If last post by current user was posted 1 seconds or more but less then 3000 do this"; } else { echo "Else do this"; } ///////////////////////////////////////////////////////////////////////////////////////////////////////// wp_reset_postdata(); endwhile; ?>
Forum: Everything else WordPress
In reply to: Manually install plugin errorThanks now it worked!
Forum: Developing with WordPress
In reply to: How to modify text color<span style="color:#fff;">your text here</span> <div style="color:#fff;">your text here</div>
Forum: Developing with WordPress
In reply to: Who clicked who likedYes ofcourse only logged in users. I think there was such a plugin some years ago. Also i think there must be some cind of code or plugin somewhere. It can’t be only me who wants or wanted this function.