Git Product home page Git Product logo

cmb2-theme-options-panel's Introduction

CMB2 Theme Options Panel

Object Oriented way of using CMB2 to make a custom Theme Options panel.

Complete Theme Options Panel developed using CMB2. - Easy to integrate and extend

Anyone can use this theme options panel in their projects. It support all fields types of CMB2.

How to USe

First of all clone this repository and place in your theme directory. Then add following line in functions.php

require_once dirname( __FILE__ ) . '/theme_options.php'; 

Once you have done this step you can see Theme options Menu in your Admin dashboard. Now open file custom_posts.php and customize this according to your needs.

To use your theme options values in frontend you can use following examples

 global $myTheme_options;
 $myTheme_options=get_site_option( 'options-page', true, false) ;
 $site_title = $myTheme_options['site_title'];
 
 $site_logo = $myTheme_options['site_logo'];

Examples:

alt text

alt text

Please follow me at https://profiles.wordpress.org/sajiddesigner/

DEVELOPED WITH alt text LOVE IN alt text PAKISTAN

cmb2-theme-options-panel's People

Contributors

rajasajidmanzoor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cmb2-theme-options-panel's Issues

Warning: Illegal string offset 'site_title' in xxx.php

Hi, I just put all php and css in a wordpress theme (modified nothing) with a CMB2 plugin,
required in functions.php .
when I trying to get options in frontend as in your example:
global $myTheme_options; $myTheme_options=get_site_option( 'options-page', true, false) ; $site_title=myTheme_options['site_title'];

it turns out this warning:
Warning: Illegal string offset 'site_title' in /......./wp-content/themes/...../.....php on line 25

any idea of how to fix this issues?
in

PHP 7.1, Wordpress Version 4.9.7

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.