WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Create plugin... (7 posts)

  1. icyville
    Member
    Posted 6 years ago #

    I'd like to create a plugin that is similar to the digg it plugin but is for my site. I have the js code that will make the image appear and grab the url and such but i don't no how to code a wordpress plugin so that it'll add the script after every post. can anyone help by giving me a tutorial or some old plugin i can just change around (all i need is a plugin to input text at the end of each post).

  2. Just Thomas Misund
    Member
    Posted 6 years ago #

    Here you go.

    Well, it does more than add text, but I'm sure you can strip it down to what you need. I hope?

  3. icyville
    Member
    Posted 6 years ago #

    what's wrong with this code i created, it says i have a parse error on line 1

    <?php
    
    /*
    Plugin Name: Dope-Submit
    Plugin URI: http://www.thatssuperdope.com/dopeitwpplugin.html
    Description: Give your readers a way to submit articles to Thats Super Dope.
    Version: 1.0
    Author: Bruce Ackerman
    Author URI: http://www.icyville.com/
    */
    
    function dope_submit($content) {
    
    	if ( !is_feed() && !is_page() )
    
    		$content .= '<script type="text/javascript" src="http://thatssuperdope.com/evb/check_url.js.php"></script>
    ';
    
    	return $content;
    
    }
    
    add_filter('the_content', 'dope_submit', 999);
    
    ?>
  4. Just Thomas Misund
    Member
    Posted 6 years ago #

    Try deleting the first newline, so that the first two lines will be

    <?php
    /*

    Did you get what you needed from the plugin i linked you?

  5. icyville
    Member
    Posted 6 years ago #

    "Parse error: syntax error, unexpected T_STRING" Any suggestions?

    That's the error I still get. I actually modified a plugin called subscribe-remind because it was easy to do. I appreciate the link though.

    I also get all this weird code for the dope-submit plugin when I look at my plugins section of wordpress. it's like putting the php code in for the title, version and description, what the heck??

  6. Kafkaesqui

    Posted 6 years ago #

    I see nothing wrong with the code from here (well... :).

    Try downloading this copy of it and compare with yours:

    http://guff.szub.net/download/dope-submit.php

    Note that by 'compare' I don't just mean look at the two files source in an editor. Also look at how you are saving your plugin file, and how you are uploading it (if testing is not being done locally).

  7. icyville
    Member
    Posted 6 years ago #

    everything works, thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic