Shop page custom buttons which is visible to only administrator

you can use the following code to check if a user is logged in and has a valid role. add_action( ‘woocommerce_after_shop_loop_item’, ‘product_visibility_button’, 5 ); function product_visibility_button() { if ( is_user_logged_in() ) { $user = wp_get_current_user(); if ( in_array( ‘administrator’, (array) $user->roles ) ) { echo ‘<div>’; echo ‘<a class=”button” style=”margin:10px”>BTN1</a>’; echo ‘<a class=”button” style=”margin:10px”>BTN1</a>’; echo … Read more

str_replace inside specific css files [closed]

No, because the CSS file isn’t loaded in and parsed by PHP—it’s just “printed” to the browser at the appropriate time. You can, however, add inline styles to an enqueued stylesheet, which you would then be able to manipulate with filters. In the code snippet below, let’s assume you’re using wp-content/plugins/my-plugin/assets/style.css. add_action( ‘wp_enqueue_scripts’, ‘wpse406238_inline_css’ ); … Read more

Specific colours for wordpress author ids

You can check if post’s author has Administrator role like this (and output markup accordingly): if( author_can( get_the_ID(), ‘administrator’ ) ) { // author is admin } else { // author is not admin } See Roles and Capabilities if you want to check for something more specific than general role.

Salesforce lead tracking with contact forms plugins [closed]

I’ve used the Gravity Forms plugin and its post form-submission hook to fire off a server-side web2lead curl request in wordpress before now. Wasn’t too difficult. Essentially your web2lead form submission is purely server-side so the regular gravity forms entry logging (including IP etc…) just carries on working. You get your data in both WP … Read more