jQuery treetable is a jQuery plugin that you can display a tree in an HTML table with directory structure or a nested list.
by via jQuery-Plugins.net RSS Feed
"Mr Branding" is a blog based on RSS for everything related to website branding and website design, it collects its posts from many sites in order to facilitate the updating to the latest technology.
To suggest any source, please contact me: Taha.baba@consultant.com
jQuery treetable is a jQuery plugin that you can display a tree in an HTML table with directory structure or a nested list.
|
In this series, we're going through one of the fundamental features of WordPress: Conditional Tags. In this fifth part, we'll continue introducing and reviewing the Conditional Tags. Be sure to check out the previous parts if you haven't yet.
Let's begin!
is_main_site()If you're developing for WordPress Multisite, eventually there will come a time when you need to detect the main site. The Conditional Tag is_main_site will help you then: It determines whether the given site ID is the main site of the network.
This Conditional Tag has only one parameter:
$site_id (integer, optional): The site's ID to check. (Default: Current site ID)has_nav_menu()While creating a custom navigation menu, you need to specify a "menu location" with the two parameters of the register_nav_menu(s) function(s). The Conditional Tag has_nav_menu() checks whether there's a custom menu the user assigned to the given location.
This Conditional Tag has only one parameter:
$location (string, optional): Slug of the menu location. (Default: None)has_nav_menu()Let's say one of the custom menu locations of your theme needs a little JavaScript file to work properly, so you want to enqueue the script only if the menu is being used by the user. Here's what you do:
<?php
if ( has_nav_menu( 'mytheme-footer-menu' ) ) {
wp_enqueue_script( 'mytheme-footer-menu-js', 'path/to/mytheme-footer-menu.js', array( 'jquery' ) );
}
?>
is_plugin_active_for_network()Similar to is_plugin_active(), the Conditional Tag is_plugin_active_for_network() will detect whether the given plugin is active... in a Multisite installation. This might be useful if your code needs to know whether another plugin is active through the whole network, rather than a single site.
This Conditional Tag has only one parameter:
$plugin (string, required): Plugin's or sub-directory's name. (Default: None)comments_open()One of the most commonly used Conditional Tags is comments_open(). With this function in your if statement, you can determine whether comments are enabled in the current post.
This Conditional Tag has only one parameter:
$post_id (integer, optional): The post ID. (Default: 0)comments_open()Let's say you want to echo a warning before the comments section, if comments are enabled for the post. Here's what you do:
<?php
if ( comments_open() ) {
echo '<div class="comments-warning"><strong>' . __( 'Warning', 'translation-domain' ) . ':</strong> ' . __( 'All commenters are responsible for their own words!', 'translation-domain' ) . '</div>';
}
?>
is_dynamic_sidebar()Many WordPress themes use sidebars to display widget content. But if you're developing a plugin or a theme and want to determine unused sidebars, you can use the Conditional Tag is_dynamic_sidebar()—it checks whether a sidebar is active and has any widgets used in it.
This Conditional Tag doesn't accept any parameters.
is_multi_author()Most WordPress websites, I think, run with only one user. Corporate websites usually don't need more than one user, and the internet is filled with "personal blogs" (which is a good thing, don't get me wrong). However, you might want to check whether more than one author has published posts. If that's the case, is_multi_author() can help you detect WordPress installations with multiple authors.
This Conditional Tag doesn't accept any parameters.
is_multi_author()Let's say you're making a plugin just for blogs with multiple authors, and you want to warn single authors that the plugin won't work for them. Here's what you do:
<?php
add_action( 'admin_notices', 'warn_single_authors' );
function warn_single_authors() {
if ( ! is_multi_author() ) {
echo '<div class="error">
<p>' . __( 'Sorry mate, this plugin only works for blogs with multiple authors!', 'translation-domain' ) . '</p>
</div>';
}
}
?>
pings_open()If you still use trackbacks for some reason (or you need your plugin to work on really old blogs), you can determine whether trackbacks and pings are enabled in a specific post (or the post being displayed) with the help of the pings_open() Conditional Tag.
This Conditional Tag has only one parameter:
$post_id (integer, optional): The post ID. (Default: 0)is_feed()I still love feeds, but they are an obsolete part of the web nowadays. And WordPress uses them, too: It supports four different kinds of feeds in its core. If you want your function to know when it's running in a feed, you can use the is_feed() Conditional Tag—it checks whether the current query is for a feed.
This Conditional Tag has only one parameter:
$feeds (string/array, optional): Feed types. (Default: None)is_feed()Let's say you want to publish extra content in each post for your feeds (to encourage more people to subscribe). You will need a shortcode. Here's what you do:
<?php
// Usage: [feedonly]Hey there, feed readers![/feedonly]
// Source: http://ift.tt/1dRRgYq
add_shortcode( 'feedonly', 'feedonly_shortcode' );
function feedonly_shortcode( $atts, $content = null ) {
if ( is_feed() ) {
return $content;
}
}
?>
is_year()In blogs that you don't write frequently, it might be a better idea to promote yearly archives rather than monthly archives. And if you want to add different functionality or display a different design, you can use is_year() to detect year-based archive pages.
This Conditional Tag doesn't accept any parameters.
is_user_logged_in()It's a common thing to run different code for logged-in users: It might be a new menu item, it might be an extra comment field, or it might be a completely different website design. Whatever the case may be, you can detect logged-in users with the is_user_logged_in() Conditional Tag.
This Conditional Tag doesn't accept any parameters.
is_user_logged_in()Let's say you want to greet your users differently than visitors. Here's what you do:
<?php
if ( is_user_logged_in() ) {
$current_user = wp_get_current_user();
echo __( 'Good to see you', 'translation-domain' ) . ', ' . $current_user->display_name . '!';
} else {
_e( 'Welcome to our website!', 'translation-domain' );
}
?>
wp_attachment_is_image()This Conditional Tag's job is very simple: You pass the post ID as the parameter, and the Conditional Tag returns TRUE if the post's attachment is a JPG, JPEG, GIF or PNG file (and FALSE if it's not).
This Conditional Tag has only one parameter:
$post_id (integer, virtually required, technically optional): The post ID. (Default: 0)Why "virtually required" and "technically optional"? Because it defaults to 0, meaning that if you use this Conditional Tag without its parameter, it will try to return a post that doesn't exist.
post_type_exists()In some scenarios, it might be a good idea to check whether a certain custom post type is already in use. (If you're creating a portfolio plugin, for example, you might want to try to duplicate posts from a commonly used post type name for portfolios.) To do that, you can use the post_type_exists() Conditional Tag.
This Conditional Tag has only one parameter:
$post_type (string, required): Name of the post type. (Default: None)post_type_exists()Let's say you're developing a "portfolio" plugin and you chose the custom post type name "portfolio" (naturally). But many developers use the same name for portfolio post types, so you need to warn the user if another plugin or theme has already registered the post type:
<?php
add_action( 'admin_notices', 'same_post_type_warning' );
function same_post_type_warning() {
if ( post_type_exists( 'portfolio' ) ) {
echo '<div class="error">
<p><strong>' . __( 'Warning', 'translation-domain' ) . ':</strong> ' . __( 'A post type with the name "portfolio" has already been registered by another plugin or theme. This will most probably cause conflicts.', 'translation-domain' ) . '</p>
</div>';
}
}
?>
is_new_day()Some WordPress functions solve the tiniest issues, and is_new_day() is one of them: This particular Conditional Tag returns TRUE if the current post's day is different than the previous one.
This Conditional Tag doesn't accept any parameters.
In this part, we reviewed another batch of the 65 documented Conditional Tags in WordPress. In the next part, we're going to go through the remaining 13. If you have any questions or comments, shoot them below—and if you liked this article, don't forget to share it!
See you in the next part!
Do you have a blog? Want to use your blog to inspire change? This episode explores how a blogger followed her passion and grew a mega following in a few short years. More About This Show The Social Media Marketing podcast is an on-demand talk radio show from Social Media Examiner. It’s designed to help […]
This post How a Blog Launched a Movement: The Vani Hari Story first appeared on Social Media Examiner.
Social Media Examiner - Your Guide to the Social Media Jungle
This freebie contains common writing symbols such as pens, pencils, an eraser, and more.
There are 97 unique icons in this freebie. The file formats available are PNG, AI, EPS and SVG. This icon pack is by Icons8.
Easy to customize
The icons are vector-drawn. This makes it possible to edit and tweak each icon to suit your needs.
Editable source files are included. AI, EPS, and SVG can be edited in Photoshop, Illustrator, Fireworks, Sketch, etc.
Change size without affecting image-quality
For Web use, responsive design can be achieved using the SVG versions of the icons. The icons will look great, regardless of the device. For print, the AI or EPS files can be used to change the size of the images without surrendering visual-clarity.
Optimized for Web performance
The Web files of the icons are already optimized. They will load as fast as possible when viewed in a browser. After optimizing the icons, the SVG file sizes decreased by about 60%.
Easy to use
The editable source files are organized well. The layers are intuitively named. They are even color-coded for your convenience.
These icons can be used for free as part of your projects, even if said project is commercial in nature. See the README.txt file included in the icon package for more details on license/terms of use.
Icons8 is an icon search app. The Icons8 team is a small squad of designers and developers who are passionate about icons. Connect with Icons8 on Twitter, Facebook and GitHub.
The post Free Writing Icons appeared first on Six Revisions.