Introduction
Do you blog about movies or tv shows? It can be a tedious job adding movie information such as synopsis, genres, directors, cast and crew, or finding the correct artwork. Why not use a simple WordPress shortcode to do all the hard work for you.
F13s Movie Shortcode allows you to insert movie, tv show or episode information using an IMDB ID or a title and year, cutting out all the hard work.
Artwork is copied directly to your WordPress Media Library to ensure it’s always available when it’s needed and the whole plugin is cached using transient to ensure a faster page loading time.
Features:
- Responsive design
- Shows film title, year, release date
- If showing a series, the total number of seasons is displayed
- If showing an episode, the season and episode number are displayed
- Displays the plot or synopsis
- Displays a poster image if one is available
- If a poster image is available it is added to your media library and loaded locally
- Displays movie stats such as the runtime, genre, awards, director, writer, Actors
- Displays the available languages and country of origin
- Provides the IMDB rating, including a star rating image
- Adds a link to the movie on IMDB
- Utilizes transient caching to reduce page load times and api calls
Movie Shortcode
The movie shortcode allows information to be gathered about a movie, tv show or episode such as ratings, plot, artwork and general information.
Arguments:
- imdb: An IMDB ID such as “tt13842136”
- title: A movie title such as “The Matrix”
- Year: The year a movie was released (optional)
- type: The type you are adding, one of [“movie”, “series” or “episode”] (optional)
- information: default “0”, if set to “1” the information box will be open by default (optional)
- cachetime: the desired cache timeout in minutes (optional)
- disable: a comma separated list of blocks to disable. Options include – image,plot,information,rating (optional)
- trailer: a YouTube video ID. Adds a YouTube video to the movie widget (optional)
- image_size: the maximum image size (in pixels) for the cover image. This option is only available when using the OMDB API (optional) (default: 1200)
- api: set an individual widget to use an API other than the default. Options include – omdb,tmdb (optional) (default: configured in admin settings)
Please note: One of “imdb” or “title” must be set.
Basic usage
Retrieving move information using a title:
[movie title="The Matrix"]
Information
Retrieving movie information using an IMDB ID:
[movie imdb="tt0073486"]
Open information
To open the information pane by default, include the argument information=1:
[movie imdb="tt13842136" information="1"]
Information
Refining search results
If you are receiving incorrect results, for example if there are multiple versions of the movie, include other optional arguments to refind the results:
[movie title="it" year="1990" type="series"]
Information
Custom cache timeout
Other than ratings, movie information is rarely updated. For this reason it is recommended to cache the data rather than run API calls on every page load. Newer releases may have rapidly changing ratings, whereas older releases are less likely to drastically change on an hourly basis. A custom cache timout can be included in the shortcode, set in minutes:
[movie imdb="tt0067023" cachetime="14400"]
Information
Including a movie trailer
Should you wish to include a trailer in the movie widget, include the optional “trailer” attribute to specify a YouTube video ID
[movie imdb="tt0106912" trailer="4qR9a2u8ojI"]
Changing the API
Although a default API is configured in the administration settings, it is possible to manually select the API to be used for each widget. This can be useful if one API provides more desirable data. To specify a different API, include an “api” attribute in the shortcode. Valid APIs are:
- omdb – Open Movie Databsae
- tmdb – The Movie Database
[movie imdb="tt0073195" api="omdb"]
Information
[movie imdb="tt0073195" api="tmdb"]
Information
Disabling blocks
Should you wish to remove blocks from the movie widget, these can be defined using the optional “disable” attribute. The four blocks that can be disabled are:
- title
- image
- plot
- rating
- information
Should you wish to only show the title, rating and information blocks, define the remaining two blocks in the disable attribute:
[movie imdb="tt0083907" disable="image,plot"]
Information
Should you wish to only show the title and plot, define the remaining three block in the disable attribute:
[movie imdb="tt0083907" disable="image,rating,information"]
Should you wish to only show the image and plot without the title, rating and information blocks:
[movie imdb="tt0083907" disable="title,rating,information"]
Actor shortcode
The actor shortcode allows information to be gathered about an actor or notable person within the film industry. This information is only provided by “The Movie Database”.
Arguments:
- tmdb: The Movie Database person ID
- name: a notable persons name
- cachetime: the desired cache timeout in minutes (optional)
Please note: you must provide either one of “tmdb” or “name”.
Basic usage
Using ID numbers
Showing information about Clint Eastwood, by providing the TMDB ID of “190”
[actor tmdb=190]
Eastwood won Academy Awards for Best Director and Producer of the Best Picture, as well as receiving nominations for Best Actor, for his work in the films "Unforgiven" (1992) and "Million Dollar Baby" (2004). These films in particular, as well as others including "Play Misty for Me" (1971), "The Outlaw Josey Wales" (1976), "Pale Rider" (1985), "In the Line of Fire" (1993), "The Bridges of Madison County" (1995), and "Gran Torino" (2008), have all received commercial success and/or critical acclaim. Eastwood's only comedies have been "Every Which Way but Loose" (1978) and its sequel "Any Which Way You Can" (1980); despite being widely panned by critics they are the two highest-grossing films of his career after adjusting for inflation.
Eastwood has directed most of his own star vehicles, but he has also directed films in which he did not appear such as "Mystic River" (2003) and "Letters from Iwo Jima" (2006), for which he received Academy Award nominations and "Changeling" (2008), which received Golden Globe Award nominations. He has received considerable critical praise in France in particular, including for several of his films which were panned in the United States, and was awarded two of France's highest honors: in 1994 he received the Ordre des Arts et des Lettres medal and in 2007 was awarded the Légion d'honneur medal. In 2000 he was awarded the Italian Venice Film Festival Golden Lion for lifetime achievement.
Since 1967 Eastwood has run his own production company, Malpaso, which has produced the vast majority of his films. He also served as the nonpartisan mayor of Carmel-by-the-Sea, California, from 1986 to 1988. Eastwood has seven children by five women, although he has only married twice. An audiophile, Eastwood is also associated with jazz and has composed and performed pieces in several films along with his eldest son, Kyle Eastwood.
Description above adapted from the Wikipedia article Clint Eastwood, licensed under CC-BY-SA, full list of contributors on Wikipedia.
Searching by name
Showing information about Billy Idol, by providing the name attribute
[actor name="Billy Idol"]
Setting a custom cache time
Actor information rarely changes, as such it is advised to cache the data locally as API calls are much slower than local database queries to retrieve the cached data. By default, data is cached for 1,440 minutes (24 hours); if you wish to cache data for 48 hours, set the cachetime to 2,880 minutes.
[actor name="Michael Gambon" cachetime="2880"]
Gambon appeared in many productions of works by William Shakespeare such as Othello, Hamlet, Macbeth and Coriolanus. Gambon was nominated for thirteen Olivier Awards, winning three times for A Chorus of Disapproval (1985), A View from the Bridge (1987), and Man of the Moment (1990). In 1997, Gambon made his Broadway debut in David Hare's Skylight, earning a Tony Award for Best Actor in a Play nomination.
Gambon made his film debut in Othello (1965). His other notable films include The Cook, the Thief, His Wife & Her Lover (1989), The Wings of the Dove (1997), The Insider (1999), Gosford Park (2001), Amazing Grace (2006), The King's Speech (2010), Quartet (2012), and Victoria & Abdul (2017). Gambon also appeared in the Wes Anderson films The Life Aquatic with Steve Zissou (2004) and Fantastic Mr. Fox (2009). Gambon gained wider recognition through his role of Albus Dumbledore in the Harry Potter film series from 2004 to 2011, replacing Richard Harris following his death in 2002.
For his work on television, he received four BAFTA Awards for The Singing Detective (1986), Wives and Daughters (1999), Longitude (2000), and Perfect Strangers (2001). He also received two Primetime Emmy Award nominations for Path to War (2002) and Emma (2009). Gambon's other notable projects include Cranford (2007) and The Casual Vacancy (2015). In 2017, he received the Irish Film & Television Academy Lifetime Achievement Award. In 2020, he was listed at No. 27 on The Irish Times's list of Ireland's greatest film actors.
Screenshots
Installation
Installing is as simple as 1,2,3 –
Via WordPress
- navigate to WP Admin > Plugins > Add New
- search for “F13 Movie”
- install and activate
Manual
- download the source code
- upload the “f13-movie” folder to your “wp-content/plugins” folder
- activate the plugin in wp-admin
Configuration
- Visit your WordPress admin panel, usually located at www.domain.com/wp-admin
- From the menu, select “F13 Admin” > “Movie”
- Follow the instructions to obtain API keys for OMDB and TMDB
- Select your preferred default API
GitHub
Last commit: October 30, 2021 - 09:11am
Forks: 0
Open issues: 1
Stars: 0
Watchers: 0
28 comments on "WordPress Plugin: Movie Shortcode"
I have been using F13 Movie Embed Shortcode plugin and it was awsome.
But recently It got some errors and failed to fetch data from IMDB.
Instead it shows error “The movie, show or episode you requested could not be found. ” formy new and older posts too.
Hello Shahzab Khan.
First of all, I apologise for the delay in my reply. After checking the plugin at my end I can see the same issue is happening here; this is most likely a case where IMDB have altered their API.
I will look into resolving this issue and update the plugin accordingly. At some point over the next couple of weeks you should receive an update notification for the plugin via your WordPress sit admin panel.
Regards
Jim
Hi,
Is it possible to show the plot in any other language than English?
Hi Attila, I was unaware that IMDB provided other languages unitl now. From what I can see, the use of other languages requires the account to be logged in which would require considerable modification of the plugin. An alternative would be to utilise a translate API such as Google translate on the plot. The downside to this is that automatic translations can be far from perfect.
I’ve got a reasonably heavy work load at the moment, once this has been cleared I will look into the fesability of allowing the plugin access to an IMDB account to scrape the alternate languages.
Regards
Jim
how to disable plot?
how to show only rating/scroe?
Btw.. its a good plug-in. fast and works
Hi,
At the moment there is no method of enabling/disabling elements of the view. I can have a look into this and release an update nearer the end of the week. This will likely be added as an additional shortcode attribute i.e.
[movie imdb="..." hide="plot,information"]
Thank you for the suggestion, they all help to make the plugin more flexible.
Jim
Hi Gabut Review,
Version 2.0.2 has been launched via the WordPress SVN, updating to this version will add an aditional attribute “disable”.
To disable the plot use the shortcode [movie imdb="..." disable="plot"]
To show only the ratings, disable the image, plot and information blocks: [movie imdb="..." disable="image,plot,information"]
The four blocks can be included in the disable attribute in any combination, separated by commas (without spaces).
I have updated the documentation to show how these options work.
Please let me know if any further features/improvements will help.
Regards
Jim
Very happy to hear that, I will try it now
Tried installing this plugin and when trying to activate it I get the following error:
Class not found: F13\Movies\Controllers\Control
Hello Jowchar,
I have tried to replicate this issue by installing the plugin via WordPress admin and manually uploading the files from GitHub. Niether method caused this error on my test site.
The “Class not found” error would imply that the main control file is missing on the server – /wp-content/plugins/f13-movie-shortcode/controllers/control.php
If you have access to the files on the server, can you verify if that file exists? If the file doesn’t exist, it can be downloaded from here – https://raw.githubusercontent.com/f13dev/f13-movie/master/controllers/control.php
Alternatively, uninstalling and re-installing the plugin should resolve this issue as it sounds like there was an error retrieving one or more files at the time of installation.
Jim
The control.php file is there. Reinstalling results in the same error. I’m building my site on my localhost for now, would that make a difference?
Hi Jowchar,
It is quite possible that the localhost setup is using emulated paths instead of real paths, on a live server this shouldn’t be a problem.
For testing on the localhost dev environment, commenting out the realpath check should allow the plugin to operate. In reality the realpath check isn’t required, but is included to enhance the security for any third party inclusion of plugin files (it ensures files it includes are within the plugin folder).
Commenting out lines 44, 45, 46 and 48 of wp-content/plugins/f13-movie/f13-movie.php should resolve the issue.
Before:
44: if ($file !== realpath($file) || !file_exists($file)) {
45: wp_die(‘Class not found: ‘.htmlentities($name));
46: } else {
47: require_once $file;
48: }
After:
44: //if ($file !== realpath($file) || !file_exists($file)) {
45: // wp_die(‘Class not found: ‘.htmlentities($name));
46: //} else {
47: require_once $file;
48: //}
Regards
Jim
I installed 5-6 movie library plugins and I found yours quite fine. So, first of all thanks for your work. Really appreciative. Second, I want to write titles by myself. So, is there any way I can remove titles (“The Matrix”, “It”, “The Evil Dead”), like I can remove images, plots, and info?
Hello Cinemadude,
Thank you for your feedback, it’s always nice to hear suggestions for how this plugin can be improved.
I have released version 2.0.4 via the WordPress SVN, this should show in the “Dashboard” > “Updates” section on your WP site soon
This release adds the ability to disable the title in a similar way to disabling other blocks. E.g. the following shortcode will show information about “It” without the title block.
[movie title="it" year="1990" type="series" disable="title"]
Kind regards
Jim
Hi Jim,
First of all, thanks for creating this plugin.. After having tried multiple options, i can safely say that your plugin seems to be the simplest, fastest and cleanest one I have seen so far. It has all the features and functionalities I was looking for.
I have two requests please, if possible..
1. Can we have the option to control the image resolution?
2. Can we have the option (attribute) to include trailer (either embedded or even external link to youtube etc should suffice.)
Thanks in advance.
Cheers,
FM
Hi Farhan,
First of all, apologies for the long delay in getting back to you.
For point 1, this would be entirely possible, the API can provide images of varying sizes, at present the plugin retrieves the larger image (1200px max). I will look into adding the option to select the image size.
For point 2, the API doesn’t directly provide any video/trailer links. This would be possible using a secondary API to search for the trailer on youtube, although this would likely lead to errors.
A more accurate method would be to add a new attribute to the shortcode – trailer=”Y_EviQj5tvA”, where “Y_EviQj5tvA” is the youtube ID for the trailer. This would require more manual work as a trailer would have to be added manually, but would offer a more reliable method of retrieving the trailer. I am happy to add this to the next release.
Kind regards
Jim
No need for apologies Jim.. Thanks for your response.. Looking forward to the next release
Hi Farhan,
I have just released v2.1.0 which includes the ability to set the image size and include a trailer.
* The attribute “image_size=1200” will select an image with a maximum size of 1200px (this is the default size).” will insert an embedded trailer within the movie widget.
* The attribute “trailer=
Many thanks for providing these suggestions, they are very useful in widening the audience for this plugin.
Regards
Jim
Hi, is it possible to retrieve actor info? That is really what I am looking for. Thanks
Hi Mita,
The OMDB API doesn’t include endpoints for actor information, although I am looking into the possibility of adding The Movie Database as a supplementary API, as it may be possible to retrieve actor information via this.
Kind regards
Jim
Hi Mita,
Version 2.1.0 has just been released. This version allows both the Open Movie Database and The Movie Database to be used within the plugin. The latter has allowed for a new “actor” widget to be implemented.
Example usage – [actor name="Morgan Freeman"]
Regards
Jim
Thank you, that is great. However I have the actor ID (eg. nm0000142 for Clint Eastwood) in my database. Is it possible to make a shortcode that uses the name id instead of the TMDB ID as in your example?
Hi Mita,
From memory I was experiencing issues searching actors by name at the time this feature was added, I can check over the code I was working with back then and see if the API is returning more accurate results now (or if there are any errors in the calls I was sending). While there I can also check if he IMDB actor ID’s can be used as they should guarantee accurate results.
I’ll be unlikely to find time this week, although will be away from work next week.
Regards
Jim
Thank you. Really appreciate that. Someone said IMDb has redesigned the actor pages, so what didn’t work before might work now and vice versa.
how to customize the infobox, like changing the font, image placement, rating placement etc
Hi,
The best way to change the font would be with custom CSS. Some themes offer additional CSS input, otherwise, the theme CSS file can be modified in “WP Admin > Appearance > Theme file editor”.
The placement of sections within the widget would be fairly complex to add in the shortcode attributes, again custom CSS can be used to change the appearance of elements.
Regards
Jim
Why does the TMDB API token retrieve info for when i choose IMDB but not TMDB?
Hi Doug,
For movie / tv show information, the selected API should be the only one used.
I.e. if TMDB is configured on the settings page, it should be the only API used unless its overridden in the shortcode.
The only exception to this is when retrieving actor information, this will always use TMDB to retrieve the data.
Time permitting, I’ll do some experimenting and see if I can replicate the issue. If possible, could you share the shortcodes being used?
Regards
Jim