• Resolved Feyisayo1

    (@feyisayo1)


    Hi, my wordpress website has really been giving my visitors mobile optimization issues that I had to get a mobile theme specifically for mobile users.

    Now, the problem I’m having is the shortcodes in my desktop theme are rendering as plain text which is bound to happen since they are different themes.

    I read somewhere that creating a plugin for my site was the best solution to this problem, but I’m still very new to wordpress php coding and stuff. I already created a php file but what codes from my desktop theme do I have to add to my plugin’s php file to make it render the shortcodes from my desktop’s theme properly in my mobile theme?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Try using @media type print in your style sheet to customize how the theme looks on mobile . https://www.w3schools.com/css/css_mediatypes.asp should get you going

    Moderator bcworkz

    (@bcworkz)

    Extracting shortcodes from a theme and placing them in a plugin for a site with a different theme can be anywhere from simple to virtually impossible.

    First of all, do not modify your new theme, you will lose your changes when the theme updates. Create either a plugin or child theme to contain your imported shortcode handlers. Let’s assume you chose to do a plugin for the sake of further discussion.

    Copy all the calls to add_shortcode() to your new plugin. The second parameter in these calls are function names. Locate all the associated function definitions and copy them to your pugin. If any of these are inside a class definition, copy the entire class definition. If the class definition “extends” another class, find that class and copy it to your plugin if it’s on your old theme. If it’s a core WP or PHP class, no need to copy it. PHP will find it.

    Define WP_DEBUG as true in wp-config.php. Create a test post that uses all the shortcodes. View the post. If you’re really lucky, your shortcodes will work with no modification.

    More than likely you will get an error message. Resolve each error when encountered until you can publish all the shortcodes with no errors.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How To Create Plugin For My Theme’ is closed to new replies.