Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Jaja,

    you could also use a hook within your functions file (or wherever you pasted the code in a php file) to restrict the output of your script. Say you have your script in your main theme folder – called ‘myscript.js’.

    The proper way to include scripts within WordPress is with the ‘wp_enqueue_scripts’ action hook. There are some examples in your functions.php file within your theme. Here’s a quick way to restrict output using the wp_enqueue_scripts and get_current_blog_id() functions.


    <?php
    function enqueue_my_custom_scripts() {
    wp_register_script('my-script', '/wp-content/themes/mytheme/myscript.js');
    $blog_id = get_current_blog_id();
    if($blog_id == '2') {
    wp_enqueue_script('my-script');
    }

    }
    add_action('wp_enqueue_scripts', 'enqueue_my_custom_scripts');
    ?>

    Adding this code, altered to fit your Javascript code file, you should be able to effectively load the scripts only on the blog specified by the get_current_blog_id() check.

    There are also a ton of other conditionals available for WP_Query(), which will check where you are in the site and allow you to output specific code for each condition.

    Plugins are great, but if you choose one that doesn’t get updated regularly enough, you could be in for some security issues – which is why I like coding things out by hand. 🙂

    Hi Maja,

    If you can already enter shortcodes into the email template then you could probably create your own shortcodes to display the user info and insert them into the email template.

    You’d have to create the shortcode functions in your functions.php file in your theme folder. Here’s some info about creating shortcodes: WP Shortcode API on Tuts+

    You’ll want to pull the current user data in to your shortcode functions using get_currentuserinfo(). Here’s a post on how to bring the data values in: WordPress get_currentuserinfo() – WordPress.org

    As I don’t have specific information on what plugin you’re using for your rich text emails, I can’t say as it will process the shortcodes, but it’s a start!

    Good luck

    Hi ntarantino,

    you could try giving a little separation between those ‘seasons’ categories by grouping the posts with a common tag, then outputting just posts with that tag.

    [display-posts tag=”my_special_tag” posts_per_page=”20″]

    Replace the “my_special_tag” with the tag of your choice. This way you can output the posts in tons of different combinations by adding a few standard tags.

Viewing 3 replies - 1 through 3 (of 3 total)