Forums

Account Manager, Project Manager, Writer, Muslim, Father, Entrepreneur, Cook

Forum Replies Created

Viewing 15 posts - 31 through 45 (of 74 total)
  • Author
    Posts
  • in reply to: Widgets (sidebar.php) #1544
    Nadir Keval
    Keymaster

    Display a list of posts in excerpt or full-length form. Choose one or the other as appropriate.
    Include wp_link_pages() to support navigation links within posts.

    in reply to: Untrusted Data #1542
    Nadir Keval
    Keymaster

    The Theme’s main navigation should support a custom menu with wp_nav_menu().
    Menus should support long link titles and a large amount of list items. These items should not break the design or layout.
    Submenu items should display correctly. If possible, support drop-down menu styles for submenu items. Drop-downs allowing showing menu depth instead of just showing the top level.

    in reply to: Untrusted Data #1541
    Nadir Keval
    Keymaster

    The Theme’s main navigation should support a custom menu with wp_nav_menu().
    Menus should support long link titles and a large amount of list items. These items should not break the design or layout.
    Submenu items should display correctly. If possible, support drop-down menu styles for submenu items. Drop-downs allowing showing menu depth instead of just showing the top level.

    in reply to: Untrusted Data #1540
    Nadir Keval
    Keymaster

    There are few special template tags for common cases where safe output is needed. One such case involves outputing a post title to a title attribute using the_title_attribute() instead of the_title() to avoid a security vulnerability. Here’s an example of correct escaping for the title attribute of a post title link when using translatable text:

    in reply to: Plugin API Hooks #1538
    Nadir Keval
    Keymaster

    You should escape dynamically generated content in your Theme, especially content that is output to HTML attributes. As noted in WordPress Coding Standards, text that goes into attributes should be run through esc_attr() so that single or double quotes do not end the attribute value and invalidate the XHTML and cause a security issue. Common places to check are title, alt, and value attributes.

    in reply to: Plugin API Hooks #1537
    Nadir Keval
    Keymaster

    Theme and plugin developers interested in adding new options to a theme’s Theme Customization page should see the documentation on the Theme Customization API. Additional tutorials on the Theme Customization API are available at the Ottopress.com website.

    in reply to: Plugin API Hooks #1536
    Nadir Keval
    Keymaster

    As of WordPress 3.4, a new Theme Customization feature is available by default for nearly all WordPress themes. The Theme Customization admin page is automatically populated with options that a theme declares support for with add_theme_support() or using the Settings API, and allows admins to see non-permanent previews of changes they make in real time.

    in reply to: Plugin API Hooks #1535
    Nadir Keval
    Keymaster

    Most Action Hooks are within the core PHP code of WordPress, so your Theme does not have to have any special tags for them to work. But a few Action Hooks do need to be present in your Theme, in order for Plugins to display information directly in your header, footer, sidebar, or in the page body. Here is a list of the special Action Hook Template Tags you need to include:

    in reply to: Query-based Template Files #1531
    Nadir Keval
    Keymaster

    If your Theme needs to have even more control over which Template files are used than what is provided in the Template Hierarchy, you can use Conditional Tags. The Conditional Tag basically checks to see if some particular condition is true, within the WordPress Loop, and then you can load a particular template, or put some particular text on the screen, based on that condition.

    in reply to: Query-based Template Files #1529
    Nadir Keval
    Keymaster

    You can get even more specific in the Template Hierarchy by providing a file called, for instance, category-6.php — this file will be used rather than category.php when generating the page for the category whose ID number is 6. (You can find category ID numbers in Manage > Categories if you are logged in as the site administrator in WordPress version 2.3 and below. In WordPress 2.5 the ID column was removed from the Admin panels. You can locate the category id by clicking ‘Edit Category’ and looking on the URL address bar for the cat_ID value. It will look ‘…categories.php?action=edit&cat_ID=3’ where ‘3’ is the category id). For a more detailed look at how this process works, see Category Templates.

    in reply to: Query-based Template Files #1527
    Nadir Keval
    Keymaster

    To use the Template Hierarchy, you basically need to provide special-purpose Template files, which will automatically be used to override index.php. For instance, if your Theme provides a template called category.php and a category is being queried, category.php will be loaded instead of index.php. If category.php is not present, index.php is used as usual.

    in reply to: Custom Page Templates #1523
    Nadir Keval
    Keymaster

    That way, you will only have to alter the HTML and PHP code, instead of creating it all from scratch. Examples are shown below. Once you have created the Page Template and placed it in your Theme’s directory, it will be available as a choice when you create or edit a Page. (Note: when creating or editing a Page, the Page Template option does not appear unless there is at least one template defined in the above manner.)

    in reply to: Custom Page Templates #1521
    Nadir Keval
    Keymaster

    What follows the above five lines of code is up to you. The rest of the code you write will control how Pages that use the Snarfer Page Template will display. See Template Tags for a description of the various WordPress Template functions you can use for this purpose. You may find it more convenient to copy some other Template (perhaps page.php or index.php) to snarfer.php and then add the above five lines of code to the beginning of the file.

    in reply to: Custom Page Templates #1519
    Nadir Keval
    Keymaster

    The file may be named almost anything with a .php extension (see reserved Theme filenames for filenames you should not use; these are special file names WordPress reserves for specific purposes).

    in reply to: Custom Page Templates #1518
    Nadir Keval
    Keymaster


    The above code defines this snarfer.php file as the “Snarfer” Template. Naturally, “Snarfer” may be replaced with most any text to change the name of the Page Template. This Template Name will appear in the Theme Editor as the link to edit this file.

Viewing 15 posts - 31 through 45 (of 74 total)
Back to top