Articles of posts

get post id in while loops outputting page id

it’s been a while since I used wordpress and I am trying to us e advanced custom fields, I am trying to output the post ID inside a loop on a page, so i can use get_field to output the post contents. Ths $post->ID gives me the page id not the post id so thr […]

Get current users post URL?

I’ve been trawling through forums but can’t find a solution to this. If anyone can help, it would be greatly appreciated! I’m trying to display a link to current users author page (all users have author permissions). I’m using this at the moment: <a href=”<?php echo home_url() . ‘/author/’ . get_the_author_meta( ‘user_login’, wp_get_current_user()->ID ); ?>” […]

count_many_users_posts except current logged in user?

Is there a way to count and show the count of all author posts in a custom post type except the current logged in user? I was hoping there’s a way to do it with count_many_users_posts but it doesn’t appear there is a way to exclude authors, only include them. I’ve done multiple searches but […]

How to disable single post view in wp

I want know, How to disable single post view in wp. any plugin or setting??? Is there a way to disable single post page, for example when some tries to go to single post page to show not found or 404 page.

Locked/Unlocked in title

This should be incredibly easy, but I’m missing something. This code should simply work if they have entered their password into a password protected post/page. The idea is to remind them it is protected. However… I can’t get it to work at all. The if statement never returns true. For some reason, I don’t think […]

Amend wordpress password function

I simply want to add a H2 or whatever html tag above the content in this password protection function. Is this correct? function my_password_form() { global $post; $label = ‘pwbox-‘.( empty( $post->ID ) ? rand() : $post->ID ); $o = ‘<h2><br>Password Protected Area</h2><form action=”‘ . esc_url( site_url( ‘wp-login.php?action=postpass’, ‘login_post’ ) ) . ‘” method=”post”> ‘ […]

How to Use PHP Code In-Page?

I am looking to create a dynamic Add-to-Cart button. The problem is that I need my server to dynamically create the “add-to-cart” URL. Currently, I have a static example built here at this link. You’ll notice at the bottom of the page is a pay-per-post function, and an “Unlock Full Article” button. I would like […]

database columns: post_title vs post_name

I changed post_title, post_contents, and post_name to allow for utf by changing collating sequence to: utf8_general_ci Then using add new post, I type for the title three Hebrew ALEFs. The post_title is in Hebrew in the database, but the post_name has this value: %d7%90%d7%90%d7%90 According to Charmap, ALEF has a hex value of 05D0. So […]

WordPress Delete hook with wp_delete_post function?

I have this action/hook: add_action( ‘before_delete_post’, ‘my_delete_function’ ); function my_delete_function($post_id) { global $wpdb; $achievement = get_the_category($post_id); $h = $achievement[0]->cat_ID; $s = ”.str_replace(‘”‘, ”, $h); if ( $s == 6 || $s == 5){ $wpdb->query(“DELETE FROM wp_votes WHERE post = “.$post_id) or die(mysql_error()); } } The above works great when I am deleting posts from the […]

Add link on the top menu of the post table?

Is there any way to add links on the top, as pictured below?