Supreme is a child theme which works on top of our Supreme parent theme which also powers our other recent themes
With 3.0 Oslobodi, WordPress je predstavio novi korisnički interfejs koji pomaže u upravljanju navigacionim menijima, što jednostavno znači da ćete dobiti novu stranicu sa nekim alatima koji će vam pomoći da dodate, Izbrišete, i rasporediti linkove.
Korišćenje ove funkcije, prvo ga morate aktivirati. Bez aktivacije, vaša stranica za upravljanje menijima neće prikazati ništa, ali greška.
Ako je trenutno neaktivan, na vašem WordPress administrativnom panelu, idite na > "Izgled" da biste videli grešku.
Kako aktivirati WordPress 3.0 Menu Management
Add the following code to the functions.php file of your theme.
[Php]Ako (function_exists('add_theme_support')) {
add_theme_support('meniji');
}
[/Php]
Dok add_theme_support('meniji'); je dovoljno za aktiviranje stranice "Upravljanje menijima", dodatni kod oko ove neophodne linije obavezno ako kasnije ili ranije verzije WordPress-a nemaju ovu funkciju onda jednostavno neće uraditi ništa i neće izazvati grešku.
Šta znači šifra iznad:
The code above simply means if the Add Theme Support function exists, use that function to add Menus feature. Ako ne postoji, ne radi ništa.
Step by Step
- Open theme folder and find functions.php.
- Otvaranje funkcija.php pomoću programa "Beležnica" ili uređivača teksta po vašem izboru.
- Kopiranje i lepnjenje gorenavedene šifre.
- File > Save functions.php
Where to place the code
If the functions.php file of your theme is messy or you don’t really know where to place the code, idite na kraj funkcija.php nalepite kôd pre:
[Php]?>[/Php]
Znak pitanja odmah pored strelice nadesno označava kraj skupa šifara. Poslednja kombinacija znaka pitanja i strelice nadesno u datoteci označava kraj datoteke. Normalno, ako dodate bilo koji kôd neposredno pre nego što se datoteka završi, ne bi imao problema.
U retkom slučaju da vaša tema ima funkciju.php datoteku, ali je prazna, kopiranje i lepnjenje sledećeg koda:
[Php]<?Php
Ako (function_exists('add_theme_support')) {
add_theme_support('meniji');
}
?>[/Php]
Ovaj skup šifara se samo malo razlikuje od onoga što vam je prvi put dato. Dodatna
[Php]<?Php[/Php]
I
[Php]?>[/Php]
na početku i završetku ovog skupa kodova znači pokrenuti PHP i end PHP.
Možete da zatvorite funkcije.php. Do kraja ovog uputstva, Ne treba ti. Now you’ve activated the Menu Management feature or user interface, here’s what it looks like:
Using Menu Management User Interface
If you use wp_nav_menu() in theme template files to display the menu, by default, it will list only links with a Page attached to it. But, what if you wanted to add custom external links without creating a new page just to point to it? For example, adding a Twitter link to your site’s main menu. Here’s how.
First, create a custom menu because WordPress will not allow you to add, Izbrišete, or re-arrange links without at least having one custom menu. Name your menu then save it. For this tutorial, my first custom menu is named, ‘first.’
After creating the custom menu, you have several options on Menu Management page to add links. For example, you can simply check the boxes next to the Pages and Categories you want to add then click the Add to Menu Dugme. You can also add custom links and here’s what it looks like:
Don’t forget to click the Save Menu button after adding new links.
How to Display Custom Menu
Like I mentioned before, wp_nav_menu() by default displays your list of links based on what Pages you have. It doesn’t display custom menu links. To display the custom menu wherever you want it to show up, copy and paste the following:
[Php]<?php wp_nav_menu(‘menu=first’); ?>[/Php]
Replace ‘first’ with the name of your menu.
Šta znači šifra iznad:
- Start PHP
- Use wp_nav_menu() to display menu
- The custom menu I want to use is ‘first.’
- End PHP
In whichever file you’re pasting it in, save the file. Upload this file to the theme folder on your server if you’re not directly editing it through the WordPress administration panel.
I created a blank theme just for this tutorial. Here’s what it looks like for me after putting the code above in the index.php file of my blank theme.
If you right click on the page currently displaying your menu and go to View Source, you get to see what this menu looks like under the hood. Here’s what it looks like for me:
[Php]<div class="menu-first-container">
<ul id="menu-first" class="menu">
<li id="menu-item-4" class="menu-item menu-item-type-custom"><a href="http://son">son</a>
<ul class="sub-menu">
<li id="menu-item-6" class="menu-item menu-item-type-custom"><a href="http://grandchild">grand child</a></li>
</ul>
</li>
<li id="menu-item-5" class="menu-item menu-item-type-custom"><a href="http://daughter">daughter</a></li>
</ul>
</div>
[/Php]
Wherever you see ‘first’ in the set of codes above, you know it’s there only because I named the custom menu ‘first.’
Display Multiple Custom Menus
To do that, you have to first create the second menu. Here’s my second menu, which is conveniently named, ‘second.’ And, I’ve added two links under the second menu.
To display the second menu, duplicate code for the first menu and change menu=first to menu=second. If you named your second menu, ‘submenu,’ then change menu=first to menu=submenu. Here’s the entire code:
[Php]<?php wp_nav_menu(‘menu=second’); ?>[/Php]
Differentiating Custom Menus and Customizing Them
There are several ways to differentiate and customize custom menus. The most obvious one is using different names for first and second menus. The less obvious ways are customizing container_class, container_id, I menu_class. For example:
[Php]wp_nav_menu(‘menu=first&menu_class=my-main-menu’);[/Php]
Under the hood, by adding menu_class=my-main-menu using the ampersand sign (&), my menu list changes from:
[Php]<ul id="menu-first" class="menu">[/Php]
to:
[Php]<ul id="menu-first" class="my-main-menu">[/Php]
If you want to customize the container_class along with menu_class, here’s how:
[Php]wp_nav_menu(‘menu=first&menu_class=my-main-menu&container_class=container-name-goes-here’);[/Php]
As you can see, to add another customizable option to the menu, you simply use the ampersand sign, the option you’re customizing, and the value of that option, which can be any string of texts of your choosing. After you’ve added the code, save the file, refresh the web page, and check under the hood by choosing View Source to see the changes made.
For a list of options you can customize or assign values to, go to wp_nav_menu at the WordPress Codex.