Coder Social home page Coder Social logo

digimix / cmb2-related-links Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cmb2/cmb2-related-links

0.0 2.0 0.0 10 KB

Custom field type for CMB2 which adds a releated links repeatable group field.

PHP 76.90% JavaScript 11.78% CSS 11.32%

cmb2-related-links's Introduction

CMB2 Related Links

Special CMB2 Field that allows users to add a related links repeating field group. This is not a standard field type, but instead a function you use in combination with CMB2::add_field(). Each link can be populated with existing WordPress content by clicking on the search button.

The only required parameter is the 'id' parameter, though you can override almost all of the arguments by passing them in.

This field requires the CMB2 Post Search field.

Example

// Add a related links field.
$cmb->add_field( cmb2_related_links_field( array( 'id' => 'yourprefix_related_links' ) ) );

If you are looking to bundle this field in your plugin or theme, you will need to pass the second parameter which is an array of all the translateable strings:

$translateable = array(
	'description' => __( 'Add links, or select from related content by clicking the search icon.', 'yourtextdomain' ),
	'group_title' => __( 'Link {#}', 'yourtextdomain' ),
	'link_title'  => __( 'Title', 'yourtextdomain' ),
	'link_url'    => __( 'URL', 'yourtextdomain' ),
	'find_text'   => __( 'Find/Select related content', 'yourtextdomain' ),
);
$cmb->add_field( cmb2_related_links_field(
	array( 'id' => 'yourprefix_related_links' ),
	$translateable
) );

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.