Select a Text for CSS

Start by creating a stylesheet for your plugin.Then you can use the do_action(‘admin_enqueue_scripts’) to enqueue it in the controlpanel only, avoiding it to be loaded in the frontend. You could do something like this: function my_plugin_admin_styles() { wp_enqueue_style(‘my-plugin-admin-style’, plugin_dir_url(__FILE__) . ‘assets/css/admin-style.css’, array(), ‘1.0.0’, ‘all’); } add_action(‘admin_enqueue_scripts’, ‘my_plugin_admin_styles’); Just make sure to correct the path for … Read more

Remove `View post` Text

I think the issue is this piece of code $messages[‘game’] = $messages[‘post’];. $messages will contains all the updated messages for all custom post type. In this case, your CPT is game, so you should change the array item of game only. The correct code should be public function game_updated_messages( $messages ) { $messages[‘game’][1] = ‘Post … Read more

Parse error : syntax error, unexpected ‘)’ in

You have a missing closing bracket on your params parameter on the array_merge(). It should look like this: return array( ‘name’ => __(‘Custom Fields’, ‘thegem’), ‘base’ => ‘gem_custom_fields’, ‘icon’ => ‘thegem-icon-wpb-ui-custom-fields’, ‘category’ => __(‘TheGem’, ‘thegem’), ‘description’ => __(‘Custom Fields’, ‘thegem’), ‘params’ => array_merge( /* General – Layout */ thegem_cf_set_layout_params(), /* General – Styles */ thegem_cf_set_style_params(), … Read more

How to hide ids from URL [closed]

That’s a basic facet of how web browsers work, you pass the ID as fragment in the address bar and it knows to scroll to that point. It would be possible to bodge your way around it with an event handler, but That’s not specific to WordPress, so would be best asked on a different … Read more

How to get taxonomy image in single.php?

ChatGPT answer worked: $categories = get_the_terms(get_the_ID(), ‘car-brand’); if ($categories && !is_wp_error($categories)) { // Assuming you have only one category per post, you can use the first one $category = $categories[0]; // Get the category image using ACF $category_image = get_field(‘am-brand-img’, $category); $size=”am-thumbnail”; $category_thumb = $category_image[‘sizes’][$size]; $category_country = get_field(‘am-brandcountry’, $category); $category_cimage = get_field(‘am-brandcimage’, $category); // Display … Read more

Allowing a CPT post to be edited by a single user role

Add code – your current active theme’s functions.php file or in a custom plugin: // Step 1: Create a New Role Based on Subscriber function create_custom_role() { // Check if the role doesn’t already exist if (!get_role(‘username-role’)) { // Get the capabilities of the Subscriber role $subscriber_role = get_role(‘subscriber’); $capabilities = $subscriber_role->capabilities; // Create a … Read more

How to show custom post type in all post section?

It seems pretty hacky, but this does work in my testing (I tested with built-in page post type): // Change the post list and search query. add_action( ‘pre_get_posts’, static function ( $query ) { if ( ! is_admin() || ! $query->is_main_query() ) { return; } if ( ! in_array( $query->get( ‘post_type’ ), array( ‘post’, ‘Array’ … Read more

How to stop wordpress from redirecting from the post’s old slug after changing title and slug?

You need to provide a higher priority number than the default when removing hooks. If you leave it default there’s a chance that your remove_action is executed prior to the add_action( ‘template_redirect’, ‘wp_old_slug_redirect’ ) So, instead: remove_action( ‘template_redirect’, ‘wp_old_slug_redirect’, 20 ); You also need to prevent WP from saving the old slugs which can be … Read more

tech