Display wp post views only if it’s more than 1000

I paste this code to my functions.php

function getCrunchifyPostViews($  postID){ $  count_key = 'post_views_count'; $  count = get_post_meta($  postID, $  count_key, true); if($  count==''){     delete_post_meta($  postID, $  count_key);     add_post_meta($  postID, $  count_key, '0');     return "0 View"; } return $  count.' Views'; }  function setCrunchifyPostViews($  postID) {     $  count_key = 'post_views_count';     $  count = get_post_meta($  postID, $  count_key, true);     if($  count==''){         $  count = 0;         delete_post_meta($  postID, $  count_key);         add_post_meta($  postID, $  count_key, '0');     }else{         $  count++;         update_post_meta($  postID, $  count_key, $  count);     } }   remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0); 

and this code to single.php:

<?php           setCrunchifyPostViews(get_the_ID()); ?> 

and it too:

<?php           echo getCrunchifyPostViews(get_the_ID()); ?> 

The post view is working fine, but I would like to display on single.php if the current post views is more than 1000. Any idea how can i made it?

How to run php code only for a specific widget on a page and not all widgets on that page?

I want to display extra information below the post title only for the posts widget on the home page and not the portfolio widget. I’m using WordPress’ the_title filter to do this and that works fine, but at the moment, it shows the extra info in both the portfolio and the posts widgets. I need a condition to restrict the filtering only to the posts widget. The post widget’s class name is "home-post-widget"

My current code looks like this.

function add_rating_html( $  title) {      if (in_the_loop()){         $  out = "Rating: 5";         $  title .= $  out;     }     return $  title; }  add_filter('the_title', 'add_rating_html',1);  

Any help would be most appreciated.

Key combinations with Python from focused window only?

Is there a clean and easy way to capture key combinations with Python only when the script being run is in focus (e.g. the Python intepreter/terminal or IDE window, no global capture)?

I’ve been trying the keyboard, pynput, and pygame.key for over two months, but none of these packages worked for me and some were an incredible mess to code with IMHO due to either a lack of documentation and bugs (keyboard) or too much overhead and unwieldy, convoluted classes/methods (pygame). Assume that you need to bind 50 different hotkeys – you don’t want to define a function with 10-20 lines of code for each key binding if e.g. a simple dictionary does the job. You also don’t want to be challenged to invent some god-level regex pattern for find & replace in order to write those 50 different functions if e.g. a simple dictionary does the job. You get the point.

It’s stunning that there doesn’t seem to exist a single Python package that offers a simple, concise solution for such a banal task that virtually any program that you are using right now is getting done. Try it: Alt+F4 will close your browser, but not some other applications that you might be running in the background.

I’m thinking about something along the lines of

import keyboard_package as kb   hotkeys = {'ctrl+c':some_callback, 'ctrl+v':another_callback}    # BAM!  kb.bind_hotkeys(hotkeys)    # BAM! kb.listener_start(focus=True)    # BAM!  do_something()    # Your game main loop  kb.listener_stop()    # BAM! kb.unbind_hotkeys()    # Done! You may now go home to wife and kids. 

If it’s not possible to limit the capture on one window, I’m also fine with having the callback pause the listener, e.g. while a certain very long loop is running and you need to write an e-mail in the meantime without accidentally triggering a core meltdown by doing Ctrl+C and Ctrl+V in Outlook.

Wish list:

  • Capture hotkeys only in focused window
  • Simple, pythonic – I’m not your beta tester
  • Straight/"no BS" package that gets the job done without forcing the user do a degree on ancient Egyptian philosophy

How to restrict Users to see only their databases where has access?

I need to restrict the list of database for our users in a SQL Instance In order to move forward this I revoked the view any database permission to the user desired. But I figured out that only applies for databases owners so if you have access to a database but noy like db_owner even if for this user you deny "view any database". Keep listed the database on the instance

I would like to know how I can restrict to the users to only see their databases where are owners and also databases where only have access.

USE [MASTER] GO DENY VIEW ANY DATABASE TO [MYACCOUNT] GO 

How to move wordpress to subdomain, keeping only .htaccess and/OR index.php in root domain?

I would like to move all files & folders of the root directory to the subdomain & keep the root directory empty with only the .htaccess file or index.php

I tried to search a lot but fail to get the solution. Only one I got it but that is also not completely working.

https://totalwebsecuritypro.com/moving-wordpress-to-new-subdomain-or-directory/

It is working perfectly if I will move to the subdirectory, which is also mentioned on wordpress.org but moving to the subdomain is missing.

On this site – Frontpage is working perfectly but the link to the other posts are not working well.

Sharing url link does not show thumbnail image on facebook but only title

I try to use FB Debug tools, it’s very useful information. It said support WebP image extension?

but the Question why some posting support ( this one showing )

this one show Image https://www.eitren.com/life-video/not-give-up-with-highly-hope-save-this-dog-in-the-hard-situation-but

this one Title only https://www.eitren.com/apps/hows-your-seo-brand-link-performance-in-serp-ranking

I’m still finding out the problem, but FB debug tools very useful

https://developers.facebook.com/tools/debug/

Thank you

Linked server only works if I am on the machine itself. I can’t use it from my local computer. what is missing?

I have a few queries that I use to monitor log shipping. Sometimes I want to run those queries on a different server. I usually do that through a linked server.

I have a server called SQLDEV4-TS that has a linked server to MY_SERVER\DEVELOPMENT

ON SQLDEV4-TS I have setup Kerberos as per the picture below:

enter image description here

I have this query below that I use to test the connectivity to the linked server.

DECLARE @server_name sysname = @@servername SELECT @server_name=N'MY_SERVER\DEVELOPMENT'   DECLARE @sql NVARCHAR(MAX) = N'SELECT * FROM OPENQUERY([' + @server_name +'],        ''SELECT ''''Radhe'''' AS Radhe'');'  BEGIN TRY     EXEC sp_testlinkedserver @server_name      EXEC sp_executesql @sql=@sql  END TRY BEGIN CATCH     SELECT [error_number]=ERROR_NUMBER(), [error_message]=ERROR_MESSAGE(); END CATCH;  PRINT 'We got past the Catch block!'; 

When I am on the server itself – SQLDEV4-TS – and I run the above script I get the following result:

enter image description here

All good – it works as expected – no problem.

However, when I connect to SQLDEV4-TS from my local machine, and run the script (on my machine) I get the following result:

Login failed for user ‘NT AUTHORITY\ANONYMOUS LOGON’.

enter image description here

What is missing in this linked server setting, that I have to be on the machine itself for it to work?