Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8420333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:51:52+00:00 2026-06-10T02:51:52+00:00

I have a WordPress based website, and some of the content is loaded through

  • 0

I have a WordPress based website, and some of the content is loaded through javascript.
For example:

jQuery(".portfolio-fs-slides").css({"display":"none"}).prepend('<div class="portfolio-fs-          slide current-slide portfolio-ppreview"><div class="project-coverslide"></div><div id="content" class="content-projectc contenttextwhite"></div></div>');

What I want to do is append this shortcode: <?php echo do_shortcode('[daisy]'); ?>

But as far as I know is not really possible to append php code in javascript.
Is there any workaround to accomplish this ?
Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T02:51:53+00:00Added an answer on June 10, 2026 at 2:51 am

    As @Bergi mentioned, the PHP will run serverside, and the JS will run client side. You can output JS (or parts of your JS) via PHP and have it run client side, e.g.

    <script>
        // extra code here
        jQuery(".portfolio-fs-slides").css({"display":"none"}).prepend('<div class="portfolio-fs-          slide current-slide portfolio-ppreview"><div class="project-coverslide"></div><div id="content" class="content-projectc contenttextwhite"></div></div>'); 
        <?php echo 'we can output valid js here' ?>
        // more code here
    </script>
    

    One way to think of this is that since PHP runs server side, it will always run before the JS is parsed.

    Put another way, you could have a javascript line like this:

    console.log(<?php echo $someVariable ?>);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a wordpress based website. I have a standard wordpress loop that executes
I have a website based on Wordpress, built with pages. I need to have:
I am working with wordpress and I have to display a menu based on
i have wordpress blog in my custom built website, i am displaying some posts
I have a website based on wordpress. I want to implement a click tracking
I have a Wordpress-based website which uses Sphinx as a search engine, with a
I have a Wordpress based website that I scrap using wget. I have articles
I have a user based website with Wordpress and from their profile settings they
At the moment, I have a wordpress-based site at http://sub.mydomain.com , running for 2
i'm building a wordpress webpage based on the Skeleton Wordpress theme. I have 2

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.