Forum Replies Created

Viewing 1 replies (of 1 total)
  • Hello

    I’m a beginner in wordpress and with the plugin
    But I succed to add a personal MetaData for my movie ISBN
    I dunno if it ‘s the best way
    But i have new value in mysql base with the key “_wpmoly_movie_isbn” in the table wp_postmeta

    I modified the followg files

    File : wpmpoly-shortcodes
    – array movies and movie in value my new meta ISBN


    ‘meta’ => array(
    ‘default’ => null,
    ‘values’ => array( ‘director’, ‘runtime’, ‘release_date’, ‘genres’, ‘actors’, ‘overview’, ‘title’, ‘original_title’, ‘production’, ‘country’, ‘language’, ‘producer’, ‘photography’, ‘composer’, ‘author’, ‘writer’, ‘isbn’ ),
    ‘filter’ => null

    – array movie_meta
    I ad a key
    ‘key’ => array(
    ‘default’ => null,
    ‘values’ => array( ‘director’, ‘runtime’, ‘release_date’, ‘genres’, ‘actors’, ‘cast’, ‘overview’, ‘title’, ‘original_title’, ‘production’, ‘country’, ‘language’, ‘producer’, ‘photography’, ‘composer’, ‘author’, ‘writer’, ‘isbn’ ),
    ‘filter’ => ‘esc_attr’

    – and a alias

    ‘aliases’ => array(

    ‘movie_homepage’,
    ‘movie_isbn’

    File: wpmoly-movies.php

    $wpmoly_movie_meta = array(….
    ‘homepage’ => array(
    ‘title’ => __( ‘Homepage’, ‘wpmovielibrary’ ),
    ‘type’ => ‘text’,
    ‘filter’ => ‘esc_html’,
    ‘filter_args’ => null,
    ‘size’ => ‘half’,
    ‘group’ => ‘meta’,
    ‘rewrite’ => null
    ),
    ‘isbn’ => array(
    ‘title’ => __( ‘Isbn’, ‘wpmovielibrary’ ),
    ‘type’ => ‘text’,
    ‘filter’ => ‘esc_html’,
    ‘filter_args’ => null,
    ‘size’ => ‘half’,
    ‘group’ => ‘meta’,
    ‘rewrite’ => null
    )
    );

    File: class-wpmoly-formatting-meta.php

    I add a function in class WPMOLY_Formatting_Meta {

    public static function format_movie_isbn( $data ) {

    $output = array();

    $data = explode( ‘,’, $data );
    $data = array_map( ‘trim’, $data );

    foreach ( $data as $d ) {
    $output[] = apply_filters( ‘wpmoly_movie_meta_link’, array(
    ‘key’ => ‘isbn’,
    ‘value’ => $d,
    ‘type’ => ‘meta’,
    ‘text’ => $d,
    ‘title’ => sprintf( __( ‘Movie ISBN %s’, ‘wpmovielibrary’ ), $d )
    ) );
    }

    if ( ! empty( $output ) )
    $output = implode( ‘, ‘, $output );

    $output = self::format_movie_field( $output );

    return $output;
    }

    To add setting on the new metadata
    File : wpmoly-settings.php

    // Default movie meta to show
    ‘sort-meta’ => array(
    ‘id’ => ‘wpmoly-sort-meta’,
    ‘type’ => ‘sorter’,
    ‘title’ => __( ‘Movie metadata’, ‘wpmovielibrary’ ),
    ‘desc’ => __( ‘Which metadata to display in posts: director, genres, runtime, rating…’, ‘wpmovielibrary’ ),
    //’callback’ => ‘sorted_markup_fields’,
    ‘compiler’ => ‘true’,
    ‘options’ => array(
    ‘used’ => array(
    …..
    ‘director’ => __( ‘Director’, ‘wpmovielibrary’ ),
    ‘runtime’ => __( ‘Runtime’, ‘wpmovielibrary’ ),
    ‘release_date’ => __( => __( ‘Adult’, ‘wpmovielibrary’ ),
    ‘homepage’ => __( ‘Homepage’, ‘wpmovielibrary’ ),
    ‘isbn’ => __( ‘Isbn’, ‘wpmovielibrary’ )
    )
    ),

Viewing 1 replies (of 1 total)