Create Short Code with Multiple attributes

We are going to add short code and create some of its attribute

We want to call post data on different pages with different categories and number of posts to show
also we can set post type

add this code in function.php

// This is a function for shortcode 
function custom_shortcode() {
     return 'hi i am short code function';

add_shortcode( 'shortcode', 'custom_shortcode' );

call this by using [shortcode]

Continue reading “Create Short Code with Multiple attributes”


Add Category or Tags For Pages

We have function that adds an already registered taxonomy to a custom object type.
Suppose we need to add the same categories and tags we use with posts to our Pages.

Here’s how we do it:

register_taxonomy_for_object_type( 'category', 'post' );
register_taxonomy_for_object_type( 'post_tag', 'post' );

Continue reading “Add Category or Tags For Pages”

Get Specific Class name start with something

Get all classes that start with btn:

<li class="etape btn-one others"></li>
<li class="etape btn-two others"></li>
<li class="etape btn-three others"></li>

Continue reading “Get Specific Class name start with something”