Tag Info

New answers tagged

0

This has already been answered here before: If you look at the Twenty Eleven theme and other default themes you can use the featured image as a custom header image if its exactly the same width as the default header. <?php // Check to see if the header image has been removed $header_image = get_header_image(); if ( ...


0

Right I have come at this from a different angle. I registered all the posts as normal. And then depending of the variable set it will remove the menu from the backend. function remove_menu_items() { global $brandChoice; if ( $brandChoice == 'brand1' ) { remove_menu_page( 'edit.php?post_type=cpt1' ); } else if ( $brandChoice == 'brand2' ...


0

For anyone who want to achieve the same thing : add_filter( ot_settings_id() . '_args', 'my_ot_setting'); function my_ot_setting($custom_settings){ //do some work with the settings and the sections, ie append your settings. return $custom_settings; } This works if the parent theme applies this filter before saving the options like the example here : ...


0

Could there be something happening in Customizer then? I'm seeing the same thing as the OP here. I can confirm that with about 30 options my Customizer load time dropped from around 3s, to around .5s when switching to get_option over get_theme_mod Calling the methods directly I see a 2ms difference. ...


0

If you can get a dynamic variable value of the brand, then you can load wanted CPT. Inside function.php Create a link to your new function "remove_cpt_multisite". Ex: // Remove menu items for users include (TEMPLATEPATH . '/assets/functions/remove_cpt_multisite.php'); The template itself (remove_cpt_multisite.php) : <? add_action( ...


0

get_theme_mod is just a wrapper around get_option. In theory because it is another layer of abstraction it will work slower but in practice the difference should not be big enough to be noticed by a human. Actual speed differences can be caused if you have some slow code hooked on the theme_mod hooks.


1

You are underestimating the complexity of robots file handling in WordPress. The presence of physical file is one of two cases. If physical file is not present during template load is_robots() checks is performed and in positive case do_robots() runs, generating and serving the "file" on the fly. Just going ahead and creating robots.txt in arbitrary site ...


0

Question has too much detail. It doesn't matter what you want to do, if you want to run code only "once" the best time is theme's activation. probably something like if ( is_admin() && isset($_GET['activated'] ) && $pagenow == 'themes.php' ) { get_robots(); } but: This is a great example why themes should not touch functionality beyond ...


0

It looks like you are using the Settings API to add images to a gallery or slideshow. As @kuchenundkakao suggested, a post type would be a good choice especially if you will have multiple slides, or if you will use different slides inside different galleries. If you don't need a custom post type (it is easily overkill), it would be easiest to display a ...


0

It seems like you try to code your own slider plugin, right? You could just go and register a custom post type "slide" and then give it some meta boxes. This way, you don't have to fix the number of slides, and you can just use the "get_posts" function for retrieving your slides. Just a thought ^^


1

You can use PHP's stripslashes() command: <?php echo stripslashes( get_option( 'myOption' ) );


0

For anyone who comes across this after WordPress 4.0 is released, custom controls are no longer necessary. This functionality is baked right into WordPress: https://core.trac.wordpress.org/ticket/27981.



Top 50 recent answers are included