Adding extra SVGs to TwentyNineteen child theme using class TwentyNineteen_SVG_Icons

Ok, this is what I did: First, I replicated classes/class-twentynineteen-svg-icons.php to the child theme. Renamed to class-mytheme-svg-icons.php. Added a extend with my New_SVG_Icons class: class New_SVG_Icons extends TwentyNineteen_SVG_Icons { /** * Gets the SVG code for a given icon. */ public static function get_svg( $group, $icon, $size ) { if ( ‘ui’ == $group ) … Read more

Hook when adding or editing a specific custom post type? [closed]

There is admin_enqueue_scripts(): admin_enqueue_scripts is the first action hooked into the admin scripts actions. This hook provides a single parameter, the $hook_suffix for the current admin page. And it’s an action it can only be used to callback a specified function. Usage like: add_action( ‘admin_enqueue_scripts’, ‘function_name’ ); The codex page provides even an example on … Read more

What is the action or filter for changing permalink in Edit Post/Page?

You can use the the_permalink filter to modify permalinks. Take a look at the function reference for the same. Code sample from the docs: Append the query string for the current page to permalink URLs function append_query_string($url) { return add_query_arg($_GET, $url); } add_filter(‘the_permalink’, ‘append_query_string’); More information on permalinks: Here (StackOverflow) Here (Elegant Themes) And here … Read more

Rest API Hook When Post Is Requested

My original answer was all wrong, so it’s been removed in it’s entirety. Neither the posts_selection nor wp hook are fired during the REST API request. The hook you need is rest_pre_echo_response. This hook passes three parameters: The response data to send to the client The server instance. The request used to generate the response. … Read more

How to check if certain plugin exists and in expected version

There is is_plugin_active() function. Other method is to check if functions or classes, specific to required plugin, exist. Some plugins explicitly define their own constants for this, typically with version number and/or other identifying info. There has been some developments to make extension dependence logic more generic, such as Plugin Dependecies, but they hadn’t gained … Read more

How to exclude certain widget from showing up on home/front page? [duplicate]

I’ve found the exact solution to my question here: https://wordpress.stackexchange.com/a/17687/92505 Here’s the exact code I used after some modification to make it work on my situation. Add the following code to functions.php where ‘sidebar-1’ is your sidebar ID. ‘recent-posts’ is the name of the widget your want yo hide. 12 is the length of the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)