how to indicate on post listing title if user already liked this post

Judging by the code for that like system, you should be able to find out if the user has liked the post like this: if ( is_user_logged_in() ) { $likes = get_user_meta( get_current_user_id(), ‘_liked_posts’, true ); if ( is_array( $likes ) && in_array( get_the_ID(), $likes ) ) { echo ‘<span class=”liked”>Liked</span>’; } } That will … Read more

index.php file keeps redirecting to a non-existent index.html file?

“Redirect” from index.php to index.html might be caused by your apache settings. If you have index.html before index.php in your apache config file and you have both of these files in your folder, it will go for the index.html. Try to add this to your .htaccess file (index.php preferred over index.html) DirectoryIndex index.php index.html or … Read more

How to align buttons properly [closed]

first things first lets improve your code: function action_after_question_content() { if (!is_single()) { echo “<a class=”button-default” href=””.esc_url( get_the_permalink() ).”#comments”>See Answers</a>”; echo “<a class=”meta-answer” href=””.esc_url( get_the_permalink() ).”#respond”>Give Answer</a>”; } } Note: We can improve further by getting the numbers of comments, and based on that build the buttons: Ex: If we have a plural numbers of … Read more

Is there a way to get wp_editor (tinymce) content?

I can’t comment yet… so I will use an answer, I think you need to do it with ‘wp_insert_post_data’ filter. You can see this in line 3523 here: https://developer.wordpress.org/reference/functions/wp_insert_post/ Your function need to have a parameter, which is an array. From there you should get the content from ‘post_content’ key. add_filter( ‘wp_insert_post_data’, ‘example’ ); function … Read more