Forum Replies Created

Viewing 7 replies - 61 through 67 (of 67 total)
  • Forum: Plugins
    In reply to: wp.media is undefined
    Thread Starter dgcov

    (@dgcov)

    It seems that the wp_enqueue_scripts is not calling the ‘load_wp_media_files’ function.

    add_action( 'wp_enqueue_scripts', 'load_wp_media_files' );
    function load_wp_media_files() {
      die('media upload files');
      wp_enqueue_media();
    }

    The function does not die with the error message as expected.

    [Edit!]

    Oops!

    ‘admin_enqueue_scripts’ instead of ‘wp_enqueue_scripts’ :blush:

    Forum: Plugins
    In reply to: wp.media is undefined
    Thread Starter dgcov

    (@dgcov)

    Thanks for your input.

    In fact the script works elsewhere in the theme, namely within the ‘Posts’ editing page.

    I’m only having trouble in the User Profile page.

    upload_frame = wp.media({
     *undefined is not a function*
                  title: 'Choose or Upload an Image',
                  button: { text:  'Use this image' },
                  library: { type: 'image' },
                  multiple: false
              });

    (PS: just to add that I placed wp_enqueue_media(); into my functions.php as you suggested and the error changed from “wp.media is undefined” to “undefined is not a function”. This may or may not be significant.)

    (PPS: Just checked and it’s NOT significant; the first error was in the firefox javascript console, the second was using google-chrome.)

    Thread Starter dgcov

    (@dgcov)

    Thanks.

    I just created author.php which contains the following:

    <?php get_header(); ?>
    <div class="row">
        <div class="large-8 columns">
          <?php
            $author=$_GET['author'];
            echo $author;
    
          ?>
    
        </div><!-- #row content .site-content -->
      <?php get_sidebar(); ?>
    </div><!-- #primary .content-area -->
    <?php
      get_footer();
    ?>

    The page gives me “2”, so that’s great. I can get a list of each author’s output from that….

    Thread Starter dgcov

    (@dgcov)

    It’s a theme I constructed from scratch.

    I used this to help me:

    https://themeshaper.com/2012/10/23/developing-your-theme-sense-tutorial-2/

    Thread Starter dgcov

    (@dgcov)

    Great.

    That’s what I needed. Thanks.

    Thread Starter dgcov

    (@dgcov)

    This is my hack:

    function magico_thumb_path($path,$addExt=true) {
      /*
      * if the path points to the thumbnail, then return the path to the file
      * if $addExt is false, then the path is returned without the extension so that
      * a new identifier (such as "-640x300") may be appended prior to the extension.
      */
        $ext=strrchr($path,'.');
        $size=strrchr($path,'-');
        $pos=($size=='-150x150'.$ext)?8:0;
        $name=substr($path,0,-(strlen($ext)+$pos));
        if ($addExt) {
          return $name.$ext;
        }
        return $name;
      }

    Feel free to diss it or suggest alternatives.

    (My slider uses a size 640×300, so I’m resizing to this.)

    Thread Starter dgcov

    (@dgcov)

    Hi domokun,

    (thanks very much for your response and sorry for my tardy reply)

    I removed the add_theme_suppport(‘post-thumbnails’) from the index.php and moved it to my theme’s functions.php as you suggested, but there remains no mechanism for including an image in the post type.

    I added add_theme_suppport(‘post-thumbnails’) to the file at the bottom in the root namespace.

Viewing 7 replies - 61 through 67 (of 67 total)