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

  • SEARCH
  • Home
  • 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 7950355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:14:42+00:00 2026-06-04T02:14:42+00:00

Hello all! This is my first post on stackoverflow. After hours of searching and

  • 0

Hello all!

This is my first post on stackoverflow. After hours of searching and trialing, StackOverflow coming up on alot of possible fixes: I decided it was time to ask the question myself.
I am constructing a WordPress powered portfolio website for my own web design work. I have done some extensive customization thus far and I am now at the final stretch. Also note I do not expect direct plugin support but I will cite the plugins being used, that it could help potentially.

Preface:

  1. I am using a plugin called NextGen Gallery, this plugin powers my portfolio. All my clients have their own gallery which I display on the portfolio site.
  2. I have also installed a plugin called Fancybox for WordPress. This plugin allows for a good looking lightbox display of all my clients.
  3. I have a third plugin called Custom Fields for NextGen Gallery, this plugin allows me to add custom fields specific to each gallery and image within. You will see I have already utilized this by creating custom thumbnails through a link added through the Custom Fields plugin.

All that being said my goal was to, utilizing the custom fields plugin, add html rich description text and html rich Client title text specific to each slide. The top of the slide reads the Client name and under the slide reads a description with links. I have made some progress but here is where I am stuck…

Problem:

jquery.fancybox.js will not take my PHP variable generated by “NextGen Custom Fields” plugin as it is written in a file called gallery-popportfolio.php (The template file for NGG). I have tested this extensively and had the same results. A few simple code bits added:

Within gallery-popportfolio.php I place this:

<?php $clientname = nggcf_get_gallery_field($gallery->ID, "clientnamelink"); ?>
<script type="text/javascript"> var clientname = '<?= $clientname ?>'; </script>
<script type="text/javascript" src=".../jquery.fancybox.js"></script>

Within jquery.fancybox.js I insert this:
(This is a excerpt, the only thing I add is .append(clientname):

append('<div class="fancybox-bg" id="fancybox-bg-n">').append(clientname)

Now what makes this quite interesting to me, is that within gallery-popportfolio.php if I asign $clientname to be something static like a line of text. The .js file will than accept the variable and place it exactly where I need it to be. The problem is when I apply this dynamic string to the $clientname variable it simply renders nothing. As well as this, when I echo $clientname with the complex variable in the PHP file I am getting a correct result.

Question:

I am stumped, I seemed so close yet no proper result.

Am I missing a step to make the external .js file accept a more complex php variable?

Is it possible I simply need to move the php code I have written elsewhere?

What is my next best step?

NOTES:

I was following this thread to reach where I am now: StackOverflow Thread

My working portfolio site is at: EoghanMcInerney.com

Thanks in advance for any help! Much appreciated!

  • 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-04T02:14:44+00:00Added an answer on June 4, 2026 at 2:14 am

    If you mean “not a string” by complex variable, for $clientname, then your code won’t work.

    In this line of code :

    <script type="text/javascript"> var clientname = '<?= $clientname ?>'; </script>
    

    $clientname should be a string without the ' character. I suggest you change the code above to

    <script type="text/javascript"> var clientname = <?= json_encode($clientname) ?>; </script>
    

    And when you append you should construct a string from clientname and append that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello all this is my first post here i have been working in an
Usless Background Info Hello, all. This is my first post here, but I often
This is my first post on the forum, hope all of you guys are
Hello everyone this is my first post on stack overflow.com I am trying to
This is my first post, so first hallo all. I have a little problem
First of all Sorry for the really long post, now And this is my
First of all, hello all. This problem is driving me to insanity so I
I will start with a quick Hello since it's my first post on stackoverflow.
Progressbar and Caliburn Micro Hello All, This is my first project using Caliburn so
hello all this seems to be my problem I have a table in mysql

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.