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 3958548
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T02:37:21+00:00 2026-05-20T02:37:21+00:00

I am trying to use simplemodal to have modal popups with text in wordpress

  • 0

I am trying to use simplemodal to have modal popups with text in wordpress posts. I’ve played around with various plugins but they have specific uses (such as the contact form, or another one I saw that displays a single note you can customize).

I’ve tried following this tutorial: http://wordpressthemescollection.com/ajax-wordpress-post-popup-with-simplemodal-and-jquery-488.html but the instructions are not very clear for people without advanced jquery or wordpress knowledge and it simply isn’t working for me. The author does not explain where you put the function, for instance.

For anyone who’s gotten simplemodal working in wordpress, without developing a plugin, can you please assist? Thank you.

  • 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-05-20T02:37:21+00:00Added an answer on May 20, 2026 at 2:37 am

    The tutorial is a good start on a solution, but does not quite provide all of the details. There are also some changes that I would make. Here is what I would do to get it working:

    • Create the Ajax Handler template and page
    • Make sure the link you want to use to open the modal includes the postpopup class and has the post ID in the rel attribute.
    • Create a js/ folder in your theme directory
    • Download SimpleModal 1.4.1 and place the file in the js/ folder
    • Create a custom JavaScript file (site.js) and place it in the js/ folder
    • Put the following code in site.js:

    .

    jQuery(function ($) {
        $('a.postpopup').click(function(){
            id = this.rel;
            $.get('http://yourdomain.com/ajax-handler/?id='+id, function (resp) {
                var data = $('<div id="ajax-popup"></div>').append(resp);
                // remove modal options if not needed
                data.modal({
                    overlayCss:{backgroundColor:'#000'}, 
                    containerCss:{backgroundColor:'#fff', border:'1px solid #ccc'}
                });
            });
            return false;
        });
    });
    
    • Add the following code to your theme’s functions.php file:

    .

    function my_print_scripts() {
        if (!is_admin()) {
            $url = get_bloginfo('template_url');
            wp_enqueue_script('jquery-simplemodal', $url . '/js/jquery.simplemodal.1.4.1.min.js', array('jquery'), '1.4.1', true);
            wp_enqueue_script('my_js', $url . '/js/site.js', null, '1.0', true);
        }
    }
    add_action('wp_print_scripts', 'my_print_scripts');
    

    That should get it working for you. Make sure you have the wp_footer() function in your theme’s footer. I re-worked the way the modal window was being called so that the auto-centering of the content works.

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

Sidebar

Related Questions

Trying to use a guid as a resource id in a rest url but
While trying to use LINQ to SQL I encountered several problems. I have table
I'm trying to impliment a confirmation box, but I need to edit the text
I'm trying to use jQuery SimpleModal Confirm to show a Yes/No confirmation when a
I am trying to use the SimpleModal plugin for jquery to load a popup
I'm trying to use the simple modal jquery library on a page and the
I'm trying to create a simple modal popup. I have the CSS done, and
I am trying to use Simplemodal as a pop up box on an index
Trying to use Java's regexp I want to match /app, /app/.* , but not
Trying to use the getDependentRowset in a ZF application. I have the following relationship

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.