Custom Theme functions.php – Using add_settings_field and input type=”file” to set custom logo

The examples you’ve seen are out of date. From WordPress 4.5, released in 2016, the proper way to support a custom logo was to register support for the Custom Logo feature in your theme. That link has the full documentation, but the short version is that you use this code to enable the standard logo … Read more

Create custom API endpoint to change custom header image

The header image falls under what WordPress calls theme modification values. To update that type of value, use the function set_theme_mod() function cs_set_logo($request) { set_theme_mod(‘header_image’, $request->get_param(‘new_header_image’)); return new WP_REST_Response(null, 200); } add_action(‘rest_api_init’, function() { register_rest_route(‘cs/v1’, ‘changelogo’, [ ‘methods’ => ‘POST’, ‘callback’ => ‘cs_set_logo’ ]) });

How change the header color?

(1) In your twentyten theme’s style.css file, find this rule: #access { background: #000; display: block; float: left; margin: 0 auto; width: 940px; } the black color comes from this property ang change it to your liking: background: #000; (2) In your twentyten theme’s style.css file, find this rule: #access a { color: #aaa; display: … Read more

Add custom version to an image

so you can do that in 2 different ways 1. modify directly on template-parts/content-single.php 2. you can plug it using the add_action(pre_get_post,func_with_your_staff ) inside this function func_with_your_staff( $query ) { global $wp ; if ( $query->is_single() && empty($query->post_type) $query->set(‘post_type’, ‘wherever_is_type’); // perhaps you have a custom_post_type ?> and then you can add your extra staff … Read more