Forum Replies Created

Viewing 15 replies - 511 through 525 (of 564 total)
  • Thread Starter John Huebner

    (@hube2)

    Cool, thanks, will be looking forward to it. I honestly don’t like the fact that I need to start monitoring what people are doing, especially site admins, but I guess it’s a necessary evil when you’ve got many sites to maintain and need to know who broke what.

    Thread Starter John Huebner

    (@hube2)

    <sarcasm>Wonderful</sarcasm>

    Thread Starter John Huebner

    (@hube2)

    Heh,

    I didn’t think about that, but the define should look like:

    define('WPCACHEHOME', dirname(__FILE__).'/wp-content/plugins/wp-super-cache/');

    If it must be and absolute path then this is the way the plugin should add it to prevent problems during migration for those that forget to check everything.

    On the other hand, I don’t see why this is needed unless the plugin needs it outside of WP or before WP is completely loaded. Once WP is loaded you have access to plugin_dir_path($file) which should be used to get the path.

    Thread Starter John Huebner

    (@hube2)

    You got me curious so I did a little digging into the database to look at your options and I have to say it got me a little excited 😛 and made the gears start to turn.

    Many people would create custom post types and then export and put it into the functions file of the theme or into a plugin. I don’t like doing that, things have a habit of changing more than we think they will. That’s why, even when I’m creating something I’ve created the same a dozen times I still like having the ability to edit the post type and taxonomies through this plugin. The same reason that I hate hard coding my fieldsets in ACF. Hard coding it and separating it from CPTUI means that I’d have to mess with the code to make any changes, and take a chance of screwing it up.

    But with this knowledge I could code a JSON string into a plugin to be used as part of activation, read the options stored by your plugin and insert the post types and taxonomies directly into the option for your plugin and have them available for editing just like I want when it changes.

    Insert them on activate and remove them on deactivate. A little work but easily automated.

    With this method I can both hard code them && be able to modify them if I need to. Then I just need to update the plugin with the new export.

    This is actually better than the export/import I was looking for because I can completely automate the process. I could even rewrite the JSON file when a plugin is deactivated to make sure the correct values are reinserted when it’s activated again.

    Very Cool! Appreciation for taking the time to show me this.

    Thread Starter John Huebner

    (@hube2)

    Thanks, I generally create the same post types an taxonomies on new sites, or at least I try to stay consistent when naming them. While it doesn’t take that long with the plugin it would be faster yet if I could just do an import.

    Even the copy past… I could create a file with things I can just past into the form. Will be looking forward to it.

    I may be working on a site at the time, very likely as I’m almost always working on a site and could easily test. If not and my other works is not backed up like a mountain I have various testing sites that I can use or I can set up a new one.

    Let me know when your ready to do testing and I’ll see how my schedule looks.

    Plugin Author John Huebner

    (@hube2)

    Blunt Ajax is not set up to work with JQuery, or to use a JQuery function as a callback function. If you look at the documentation I’ve created there is a section on callback functions and their requirements. The function that you’re setting as a callback function for Blunt AJAX does not use the parameters sent by my script. Please read the documentation.

    Also, if you’re loading JQuery anyway and using it to do other things then you should just be using JQuery’s methods and functions for doing AJAX. The purpose of using this plugin is to eliminate the need to load JQuery (or another framework) to do AJAX, if your loading JQuery anyway then there’s really no reason to be using this plugin.

    Plugin Author John Huebner

    (@hube2)

    I don’t usually use this ajax plugin in combination with JQuery, I’m assuming that this is because of the $. values. I created this so that I can avoid JQuery completely, I’m not a fan of frameworks.

    At any rate I’m a little confused.

    The callback function your passing to bluntAjax is:

    callback: $.ajaxFileUpload

    and I don’t see this function defined anywhere and it does not appear to be a function in any of the code you included.

    at the same time your pass value is a function. Is that the function you want to be called when the data is returned from the server?

    It this is the case then you may simply have the values of these arguments reversed.

    if $.ajaxFileUpload is a function can you post that?

    That’s pretty much the entire explanation. You basically enqueue an AJAX function as your css file. The AJAX function loads the script that will output your dynamic css. If you need additional information about using AJAX in WP you can see the codex page.

    The file that I would require “dynamic.css.php” would look something like this:

    <?php
      header('Content-type: text/css');
      // I can access any WP or theme functions
      // here to get values that will be used in
      // dynamic css below
    ?>
    /* CSS Starts Here */
    
    .example-selector {
      color: <?php echo $color; ?>;
    }

    Plugin Author John Huebner

    (@hube2)

    As far as the to-do list goes, I’ve been giving that a lot of thought lately. Please read this post I put together about it last night.

    Plugin Author John Huebner

    (@hube2)

    There are 2 issues.

    The first is where you’ve probably altered the code and the second has to due with validating the code after installation.

    Second issue first, verification with GA.

    We’ve actually been looking into using this modified version of the GA script. The problem that we run into is that GA wants to verify that you’ve made the change. It does this by reading in the source of your home page and seeing if the correct code snippet is found. This is where the problem is because this plugin does not actually include the code snippet in the source of your page. Instead the snippet they are looking for is in an external script that they cannot check.

    Unfortunately I haven’t come up with a plan yet on how this can be corrected and at this time I’m not even sure I can. In the end it will take a major overhaul of this plugin.

    First issue, where to edit the script.

    I’m going to assume that you edited the file “blunt.ga.install.v3.js” which is the uncompressed version of the script. This file isn’t actually used when running on a site. The version that is actually used id the compressed version “blunt.ga.install.v3.min.js”.

    You have 2 choices:

    1. You can try to edit the compressed version
    2. You can alter the PHP Script to load the uncompresses version. This is actually easier. On line 14 of the file “blunt.ga.class.php” you will find this line:
      private $minified = true;
      change this value to false and the uncompressed JS file will be loaded.

    Even if you make the modifications you will run into trouble with the second issue.

    Plugin Author John Huebner

    (@hube2)

    This actually makes some sense. When you compress JS it puts it all on one line. When you localize a script WP adds the usually unnecessary CDATA tags around it. This could cause this localization to be commented out depending on the browser and that would make the script fail to run.

    I know this is an old thread, but I was looking for a solution to this same problem and a search for “creating dynamic css with wordpress” returned this as the first result so, I thought I would post my solution here so that others can find it.

    This can be done acceptably well by using admin-ajax.php which is designed to allow you to access WP and only load what is necessary to do so.

    When you enqueue your style sheet, do it like this:

    wp_enqueue_style('dynamic-css',
                     admin_url('admin-ajax.php').'?action=dynamic_css',
                     $deps,
                     $ver,
                     $media);

    then create s function to load you dynamic css file

    function dynaminc_css() {
      require(get_template_directory().'/css/dynamic.css.php');
      exit;
    }

    then add your ajax actions

    add_action('wp_ajax_dynamic_css', 'dynaminc_css');
    add_action('wp_ajax_nopriv_dynamic_css', 'dynaminc_css');

    Thread Starter John Huebner

    (@hube2)

    Seems to still be the case. I’m using a different custom fields plugin now.

    Plugin Author John Huebner

    (@hube2)

    Also, aside from having 2 copies of GA running on you site.

    There was an update that turned off tracking for logged in users. Here’s my guess.

    There is a feature of the plugin that turns off tracking for logged in users. My guess it that the cached version of the page is the version that has GA turned off, likely because you were logged in and looked at the page. This is just a guess.

    Because the page and the code can actually be different and run differently based on several items a caching plugin like total cache is not likely to allow my plugin to work.

    I don’t personally use caching plugins because I create a lot of dynamic content that will not work with caching in place and loading dynamic content using AJAX defeats SEO. My philosophy is to build fast loading sites rather than fix poor development with a cache.

Viewing 15 replies - 511 through 525 (of 564 total)