UpThemes Framework এর ব্যবহার


Step 1. Add the framework to your theme

প্রথমে UpThemes Framework এর ZIP ফাইলটি Download করুন ঐবং জিপ ফাইলটি খুলুন। আপনার theme directory তে 'options' নামে একটি ফাইল তৈরি করুন জিপ ফাইলের ভিতরে থাকা সকল ফাইল ও ফোল্ডার এর মধ্যে রাখুন।
 Step 2. Create Theme Options
theme-options-example.txt ফাইলটি কপি করে আপনার theme directory তে রাখুন এবং নাম পরিবর্তন করে theme-options.php করুন।

Step 3. Include the UpThemes Framework in functions.php

নিচের কোডটি কপি করে functions.php এর সবার উপরে রাখুন
if( file_exists(get_template_directory().'/options/options.php') )
    include_once(get_template_directory().'/options/options.php'); 
 
থিম অপশন যুক্ত করতে উপরের কোডের নিচে নিম্ন বর্ণিত কোড লিখুন।
/**
* Set up General Options
*/
if( file_exists(get_template_directory().'/theme-options.php') )
    include_once(get_template_directory().'/theme-options.php') 
 
 Step 4. Customize your options
Theme Options page নতুন ট্যাব তৈরি করতে নিচের কোডটি কপি করে পেস্ট করুন।
$thistab = array(
  "name" => "colors_and_images",
  "title" => __("Colors and Images","upfw"),
  "sections" => array(
    "color_scheme" => array(
    "name" => "color_scheme",
    "title" => __( "Color Scheme", "upfw" ),
    "description" => __( "Select your color scheme.","upfw" )
    )
  )
);
register_theme_option_tab($thistab); 
 
Theme options রেজিস্টার করতে এবং তা ট্যাবের সঙ্গে যুক্ত করতে নিচের কোডটি লিখুন।
$options = array(
    //প্রথম অপশন
  "theme_color_scheme" => array(
    "tab" => $thistab["name"],
    "name" => "theme_color_scheme",
    "title" => "Theme Color Scheme",
    "description" => __( "Display header navigation menu above or below the site title/description?", "upfw" ),
    "section" => "color_scheme",
    "since" => "1.0",
    "id" => "color_scheme",
    "type" => "select",
    "default" => "light",
    "valid_options" => array(
      "light" => array(
        "name" => "light",
        "title" => __( "Light", "upfw" )
      ),
      "dark" => array(
        "name" => "dark",
        "title" => __( "Dark", "upfw" )
      )
    )
  )
  //দ্বিতীয় অপশন
  "theme_hyperlink_color" => array(
    "tab" => $thistab["name"],
    "name" => "theme_hyperlink_color",
    "title" => "Theme Hyperlink Color",
    "description" => __( "Default hyperlink color.", "upfw" ),
    "section" => "color_scheme",
    "since" => "1.0",
    "id" => "color_scheme",
    "type" => "color",
    "default" => "#ffffff"
  )
);
register_theme_options($options); 
 
অন্যান্য অপশন সমুহ নিচে দেওয়া হল ।
‘type’ => ‘text’ – standard text box
‘type’ => ‘textarea’ – standard textarea
‘type’ => ‘select’ – drop-down select
‘type’ => ‘multiple’ – multiple select
‘type’ => ‘checkbox’ – checkbox
‘type’ => ‘upload’ – WordPress media uploader
নতুন ট্যাব রেজেস্টার করতে register_theme_options_tab() যবহার করুন এবং নতুন অপশন যুক্ত করতে উপরের কোডের ন্যয় register_theme_options() যবহার করুন

মন্তব্যসমূহ