This tutorial will help you Create your own create shortcode in wordpress
welcome to the latest designs for the web tutorial here on YouTube and this tutorials going to be a short walk through demonstrating how you can create your own shortcodes to be used within your themes were for your clients to use within your themes on were press so I one is a short come short-haul really is a little bit a code that you put into your functions file and its callable by just our regular arm text call by yourself or the client .
within a post so let’s just pop it into it and take a look at this in action so I have a post here call short code in action we’re going to put some brackets around a short code that are created and I’ve created one just for a call to action by an so you can see just as simple as it is here I put CTA inside the brackets.
here’s the post page you can see right now there’s nothing there but through the magic of shortcodes when I click on update over here referee will back to a post refresh the page and sure enough there is that call to action by in that created in the functions file so how exactly does is magic occur let’s take a look now at the functions that PHP file in Word Press alright so here we are inside the functions that PHP file and here is the function on this is here this is the function that’s going to allow me to use that short code CTA alright. I don’t think there is any need of using any kind of wordpress shortcode generator because this tutorial will help you do everything.
So let’s go line by line and take a look at how this actually works as is always good practice the first line is just a comment so that you know exactly what the shortcode or dysfunction is and you know you never know down the road you go back and look in your functions filing you have a whole buncha stuff in there especially if you’re piecing it together as you’re learning on the go and so this would be very helpful to you down the road so you know exactly what it is that you are looking at alright our next line of code of course is a function this is what we want the computer we’re all one word press to do.
when we call on the shortcode so inside and these curly braces that’s where you gonna put in there whatever you want your short code to be in this instance.
I was creating some HTML that would help put a bun saw go ahead copy and paste that into you can see map okay so here we have now the code I’m going to be using that’s gonna great combine and you can see here that and make sure I included the question mark and the am greater than sign at the beginning to escape as HTML so they were not how putting anything to the page we want this to be interpreted as an actual HTML and then down here we have to finish in with this closing PHP tag alright so you could see that I’ve included some style but of course if you’re going to do this I would recommend putting that style inside a missile that CSS she so that it’s not on the page itself but just for the sake of this tutorial.
I including right inside the element and here is the link and the tax that’s going to give us that one okay and last but not least be most important part of our short code function here they were creating is we need to and this shortcode so that we can call it from within were pressed using just by simply using are short code CAW so this is pretty simple it takes to arguments are attributes you can see here the first one is the name of our short code inside a single quotes and then the second piece here is the name are the function they get serious here is the function right back up here and sinus thing or quote in a semicolon to end everything and now let’s head back over.
American save that but said back over now to were pressed so that we can see once again how we’re able to just call that alright so one more time back here in the edit post page in Word Press and you can see here’s the short code that we created over the functions file so bring him at functions file backup we have that CTA and essentially what’s happening is wherever we called a CPA inside and those brackets were present going to interpret that as the function call to action button that created here so when we put that CPA in the post and we click on update right over here to the post you’ll see it does al point the HTML.
I hope you enjoy this tutorial model or something you have any questions Be sure to check out my website WWW dot designs for the web doc on or you can hit me up on the email with my cat designs for the web dot com.
#CreateShortcodeInWordpress, #HowToCreateShortcodeForCustomPostTypeInWordpress, #HowToUseShortcodeInWordpress, #ShortcodeWordpressPlugin, #WordpressCreateShortcodeWithParameters, #WordpressCustomShortcodePlugin, #WordpressShortcodeExample, #WordpressShortcodeGenerator, #WordpressShortcodeAtts

No comments:
Post a Comment