Recent Posts
Online Members

 No online members at the moment

WordPress plugin to...
 
Notifications
Clear all

WordPress plugin to display upcoming movies


azmanagedit
(@azmanagedit)
Member Admin
Joined: 9 months ago
Posts: 88
Topic starter  

[upcoming_movies_with_filters]

This topic was modified 3 weeks ago 2 times by azmanagedit

   
Quote
azmanagedit
(@azmanagedit)
Member Admin
Joined: 9 months ago
Posts: 88
Topic starter  

Usage Instructions:

  1. Install the Plugin:

    • Upload the plugin ZIP file through the WordPress admin panel (Plugins > Add New > Upload Plugin).
    • Activate the plugin once uploaded.
  2. Configure the API Key:

    • After activation, go to the Upcoming Movies settings page by navigating to the WordPress dashboard sidebar.
    • Enter your TMDB (The Movie Database) API key in the provided field. If you don’t have an API key yet, you can sign up for one here.
    • Choose the number of columns (1-6) to display the movie posters on your website. By default, it is set to 3.
  3. Use the Shortcode:

    • To display the list of upcoming and now-playing movies on your website, simply add the shortcode display_movies on any page, post, or widget where you want the movie data to appear.
    • The plugin will automatically style the movies based on the Flexbox layout, adjusting the number of columns according to your settings.
  4. Movie Data Update:

    • The movie data is automatically refreshed every 12 hours via the scheduled task, ensuring that your site always displays the latest information.
    • The plugin fetches both upcoming and now-playing movies and stores them in a custom database table, which is displayed using the shortcode.
  5. Deactivation and Cleanup:

    • When the plugin is deactivated, the scheduled event to fetch movie data is cleared. This ensures no unnecessary background tasks continue running.
    • However, the movie data stored in the database will persist unless manually removed. If you want to delete the data, you can either clear it manually or modify the deactivation hook to drop the custom table upon deactivation (though this is not recommended if you might reactivate the plugin later).

Styling and Customization:

  1. Movie Item Styling:

    • Each movie item is enclosed in a div with the class movie-item, making it easy to apply additional custom CSS if you want to further tweak the appearance.
    • You can add hover effects, animations, or additional styling in your theme's CSS file to match your website’s look and feel. For example, you can increase the scaling effect on hover or change the background color of movie items.
  2. Movie Poster Sizing:

    • The movie posters are fetched from the TMDB API and are set to a width of 200 pixels (w200 resolution). You can adjust the size of the poster images by modifying the URL in the plugin code. If you want higher resolution posters, change w200 to w500 or another size.
  3. Genre Representation:

    • Currently, genres are displayed as IDs (as fetched from TMDB), but you can extend the functionality by mapping these IDs to actual genre names. You can create a lookup array of genre IDs to names, which will make the genre information more user-friendly.
  4. Flexbox Layout:

    • The Flexbox layout ensures that movie items are responsive and wrap correctly across different screen sizes. You can control the gap between movie items, adjust the width for smaller screens, and modify alignment using CSS.

Potential Future Enhancements:

If you’d like to extend the functionality of this plugin further, here are a few ideas:

  1. Movie Filtering and Sorting:

    • Add filters or sorting options for users to filter movies by genre, rating, or release date.
    • You can provide dropdowns or checkboxes that dynamically filter the displayed movies without reloading the page (using AJAX).
  2. Pagination:

    • If you want to display more movies than can fit on one page, you can add pagination to break the list of movies into multiple pages. This can be easily done using WordPress’s built-in pagination functions or by implementing AJAX to load more movies without reloading the page.
  3. Movie Details Modal:

    • When a user clicks on a movie poster, instead of redirecting to the TMDB page, you could show additional movie details (such as overview, cast, trailer, etc.) in a modal window. This can be done using a combination of AJAX and the TMDB API to fetch additional details.
  4. Custom Movie Widgets:

    • You can extend the plugin to include custom widgets for WordPress. These widgets could allow users to display the top-rated movies, currently trending movies, or personalized movie recommendations in their site’s sidebars or footers.
  5. Caching Movie Data:

    • For performance improvements, you can add a caching mechanism to store the fetched API results locally for a set amount of time. This would reduce the number of API calls to TMDB and improve page load times.
  6. Multi-language Support:

    • The TMDB API supports multiple languages, so you could extend the plugin to allow users to select the language in which they want to display movie titles, overviews, and other content.

Changes Made:

  1. Trailer Fetching: Added an API call to fetch movie trailers from TMDB for each movie and store the trailer URL in the database.
  2. Popup Functionality: Added a JavaScript modal that opens when users click the "Watch Trailer" button. The trailer is embedded in the popup using an iframe.
  3. Improved Styling: Added flexible layout support to display movies in columns and updated the layout for better appearance.

   
ReplyQuote
Share:

AZ Managed
IT Services llc

Contact us today to request a consultation and discover how our expert solutions can help your business thrive.