How can I stop a function from encoding an entity?

Default Editor Content Here is an updated version of the pu_default_editor_content() function which will take into account for when a user has disabled the Visual Editor (per your comment). function pu_default_editor_content( $content ) { global $post_type; switch( $post_type ) { case ‘post’ : $content=”Default content for blog posts. » » »”; $rich_editing = get_user_option( ‘rich_editing’, … Read more

How to get last updated row or ID in wordpress

I had the same problem. There is no equivalent function. $wpdb->insert_id works only after $wpdb->insert Alternative way If it’s an update, you can either get the id with a query based on the data you have got, or most of the time, you should have already got the id before update it. global $wpdb; $data … Read more

Add external js file to footer with id

You can use the script_loader_tag hook function enqueue_validation_script() { wp_register_script( ‘validation’, ‘https://www.asd.in/script.php?id=3ff00a469474bbe71a9218a7f0377518’, array( ‘jquery’ ) ); wp_enqueue_script( ‘validation’ ); } add_action(‘wp_enqueue_scripts’, ‘enqueue_validation_script’); function add_id_to_validation_script( $tag, $handle, $src ) { if ( ‘validation’ === $handle ) { $tag = ‘<script type=”text/javascript” id=”3ff00a469474bbe71a9218a7f0377518″ src=”‘.$src.'”></script>’; } return $tag; } add_filter( ‘script_loader_tag’, ‘add_id_to_validation_script’, 10, 3 );

Can’t Update function.php after writing short code

The answer by @motivast is correct. However, to avoid using a billion echo and apostrophes, you can simply close the PHP tag and open it after your script: function wpse_287665_mobile_menu_script() { ?> <script> jQuery(document).ready(function($){ $(“button.menu-toggle”).click(function(){ if( $(“button.menu-toggle”).attr(“aria-expanded”) == “true” ) { $(“button.menu-toggle”).attr(“aria-expanded”, “false”); $(“ul#top-menu”).attr(“style”, “display:none;”); } else { $(“button.menu-toggle”).attr(“aria-expanded”, “true”); $(“ul#top-menu”).attr(“style”,”display:block;”); } }); }); </script><?php … Read more

Using the child theme functions.php to change the customizer.php on parent theme

Put this code in function.php. create custom section in customizer for logo : <?php add_action(‘customize_register’, ‘theme_footer_customizer’); function theme_footer_customizer($wp_customize){ //adding section in wordpress customizer $wp_customize->add_section(‘footer_settings_section’, array( ‘title’ => ‘Footer Text Section’ )); //adding setting for footer logo $wp_customize->add_setting(‘footer_logo’); $wp_customize->add_control(new WP_Customize_Upload_Control($wp_customize,’footer_logo’,array( ‘label’ => ‘Footer Logo’, ‘section’ => ‘footer_settings_section’, ‘settings’ => ‘footer_logo’, ))); }

How to change menu icon which is overriden (i.e. by WooCommerce) [closed]

WooCommerce styles the icon via this CSS file: woocommerce/assets/css/menu.css, and here’s the corresponding code (pretty-printed or actually, I copied it from woocommerce/assets/css/menu.scss): #adminmenu #toplevel_page_woocommerce .menu-icon-generic div.wp-menu-image::before { font-family: ‘WooCommerce’ !important; content: ‘\e03d’; } So you can change the font-family and the content (and other) properties to suit your custom icon. Below is an example of … Read more

change billing and shipping address 1 and 2 field placeholders [closed]

Prior to the address fields being passed through the woocommerce_checkout_fields hook, they are retrieved by WC_Countries::get_address_fields(), and inside that function there is a comment before its filter that reads: Important note on this filter: Changes to address fields can and will be overridden by the woocommerce_default_address_fields. The locales/default locales apply on top based on country … Read more