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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:13:38+00:00 2026-06-05T05:13:38+00:00

I am creating jquery slide show plugin.. i created folder game inside wp-content/plugin in

  • 0

I am creating jquery slide show plugin..
i created folder game inside wp-content/plugin

in my folder i have
readme.txt
game.php
game.css
game.js

In my game.php
i have code:-

<?php
/*
  Plugin Name:game
  Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
  Description: A brief description of the Plugin.
  Version: The Plugin's Version Number, e.g.: 1.0
  Author: Neeraj swarnkar
  Author URI: http://URI_Of_The_Plugin_Author
  License: A "Slug" license name e.g. GPL2
 */

/*  Copyright YEAR  PLUGIN_AUTHOR_NAME  (email : neerajswarnkar0207@gmail.com)

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License, version 2, as
  published by the Free Software Foundation.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

function image() {
    hello_world_html_page();
}

add_shortcode('img', 'image');

function my_scripts_method() {
    wp_deregister_script('jquery');
    wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js');
    wp_enqueue_script(
            'game', 'http://localhost/guest1/wordpress/wp-content/plugins/game/game.js'/* don't hardcode your path */, array('jquery')/* this script depends on jquery, so enqueue it automatically */
    );
}

add_action('wp_enqueue_scripts', 'my_scripts_method');

function hello_world_html_page() {
    ?>
    <?php
    return '<div id="demo-top-bar">
        <div id="slideshow">
            <div><img alt="TITLE" src="img0.jpg"></div>
            <div><img alt="TITLE"src="img1.jpg"></div>
            <div><img alt="TITLE"src="img2.jpg"></div>
            <div><img alt="TITLE"src="img3.jpg"></div>
            <div>
                Pretty cool eh? This slide is proof the content can be anything.
            </div>
        </div>';
}
?>

In my game.js i have:-

$(function() {

    $("#slideshow > div:gt(0)").hide();

    setInterval(function() { 
        $('#slideshow > div:first')
        .fadeOut(1000)
        .next()
        .fadeIn(1000)
        .end()
        .appendTo('#slideshow');
    },  3000);

});

In game.css

    #slideshow { 
        margin: 80px auto; 
        position: relative; 
        width: 701px; 
        height: 321px; 
        padding: 10px; 
        box-shadow: 0 0 20px rgba(0,0,0,0.4); 
    }

    #slideshow > div { 
        position: absolute; 
        top: 10px; 
        left: 10px; 
        right: 10px; 
        bottom: 10px; 
    }

When i activate and run my progam.. it is showing content of js and css file.. help me i am new on wordpress..

I have updated my changes..

  • 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-05T05:13:40+00:00Added an answer on June 5, 2026 at 5:13 am

    First the JS
    You include 2 js, your own and jquery. you haven’t registered your won script you just enqueued it.
    You can enqueue and register it at once. further more I suggest you merge your que:

    function my_scripts_method() {
        wp_deregister_script( 'jquery' );
        wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js');
        wp_enqueue_script(
            'game',
            'path/to/your/js'/*don't hardcode your path*/,
            array('jquery')/*this script depends on jquery, so enqueue it automatically*/
        );
    }
    add_action('wp_enqueue_scripts', 'my_scripts_method');
    

    Doesn’t fix all your problems but it’s a step.

    2nd the html output
    your html output in hello_world_html_page will never display anywhere.
    get_option will retrieve a option from the database, it won’t execute a function.

    function image() {
        hello_world_html_page()
    }
    add_shortcode('img', 'image');
    

    This is better but stil wrong.
    A short code can’t echo or it will display properly you have to return it.

    function hello_world_html_page() {
        return '<div id="demo-top-bar">
            <div id="slideshow">
                <div><img alt="TITLE" src="img0.jpg"></div>
                <div><img alt="TITLE"src="img1.jpg"></div>
                <div><img alt="TITLE"src="img2.jpg"></div>
                <div><img alt="TITLE"src="img3.jpg"></div>
                <div>
                    Pretty cool eh? This slide is proof the content can be anything.
                </div>
            </div>';
    }
    

    3rd the CSS
    You don’t enqueue it anywhere.
    If you fix the above 2 points you should be able to handle it:

    http://codex.wordpress.org/Function_Reference/wp_enqueue_style
    As @swapnesh said there is a diffrence between wp_enqueue_style and wp_enqueue_script

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

Sidebar

Related Questions

So I tried creating the slide up down effect like in this example, http://paulsturgess.co.uk/articles/show/83-jquery-text-slide-up-slide-down-effect
I'm creating a jquery plugin for sorting and pagination a table (I know that
I'm creating a jQuery plugin that needs to do a bunch of stuff the
I'm creating a simple jquery plugin named togglebutton. My question is at the bottom.
Question about creating pages in jQuery Mobile. I've created a mobile site... if you
I am creating a calculator based on the jQuery UI range slider and have
I'm creating a webApp in which I show some table data using jQuery and
I have a form that validates using the jQuery plugin: Validation, v1.9.0. The validation
Creating a slideshow jQuery plugin, but having trouble getting it to work with more
When creating jQuery UI based websites, CSS, JS and HTML code can be splited

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.