Other tutorials on the subject WordPress :: Reducing dependencies Avanced Custom Fields ACF :: Create :: Intertionalisable dates WordPress using checkboxes Avanced Custom Fields (ACF) WordPress :: create articles philips sonicare related with Advanced Custom philips sonicare Fields (ACF) WordPress :: Basic Usage of Advanced Custom Fields (ACF)
All ACF fields are available for these new options which gives many perspectives on the opportunities available to fit a theme, for example. Among the types of options you could install, here are some ideas. Font size of the titles Color of certain content or specific texts contained in the header or footer of your page. Background of some areas of flexible Homepage with fields Flexible Content or Repeater Install add-on
If the code was not displayed, see online. Detail of the code we see if the ACF is conditional on acf_add_options_page with addition of a main page with options acf_add_options_page that accepts several parameters: page_title: title of your page in the back office menu_title: title of your menu_slug menu: the URL of your page. It will be used by the subpages philips sonicare capability: who can see the menu. To go further, refer to the WordPress codex. redirect: if false the main page is displayed in a single page in the new options. If true, we go directly to subpages. This main page is just name the new menu. Adding a sub-page with acf_add_options_sub_page that accepts multiple parameters. The first two are identical to the main page. Last parent_slug determines the parent page. This is useful if you add several pages of options in your back office. Result image
At the time of creation of the group, philips sonicare choose Options and type the options page concerned with one of the fields created groups. Here I added several philips sonicare options, the results will be used in a function that changes the CSS of the page with a <style> tag placed in the <head>. The first to change the text size. This is a number philips sonicare field. My theme, I mark the area that displays the title. The two following philips sonicare options change the text color. The last option will hide the slogan of the title if it is checked. Image result for the header options
If the code was not displayed, see online. Detail of the code: the wp_head hook, I insert CSS directly into the page with the gn_styles_options_acf function from the start, philips sonicare I check whether ACF is active with if get_field if this function exists (function_exists ('get_field')!) no, I run return which has the effect of any stopers my function. philips sonicare Otherwise, I still early, I declare my variables that retrieve items stored by ACF. Note that in addition to get_field, I must add in the option Service attributes it works I put the <style> to install CSS CSS values are replaced with the result of my variables. In the case of REM, I had to play on a value multiplied by 10 to give the equivalent philips sonicare in a pixel styles, on the class-.site description is optional. Hence the condition to see if the variable $ masquer_slogan is active. In other words, she has a stored value. Field Group footer
For this group, the result of my options fields will be placed directly in the footer.php file of the theme Twenty Fifteen. the first option is a simple text field the second option is a URL field is new in ACF 5 Result image for footer options
Here are the details of the code that is much simpler in the footer. I replace the default footer of my ACF field. As with the header, I must add option. In the beginning I control as even if the plugin is active if (function_exists ('get_field')) and if the field has a value if (get_field ('gn_texte_pied_page' option '). If so, I added my link and text entered philips sonicare into the back office. Add a second page
Compared to the first function, I add just a second time acf_add_options_page function. Here, the redirect is set to false and we reach the first blow to the main page of the options "Model". In the first, the main page of the first level does not exist. ACF Links | Page Options: philips sonicare New ACF Settings | acf_add_options_sub_page () ACF | How to get values from an options page Field groups used in the tutorial. To import with native ACF import tool.
Share on
No comments:
Post a Comment