{"id":20428,"date":"2021-07-01T14:04:50","date_gmt":"2021-07-01T11:04:50","guid":{"rendered":"https:\/\/plumrocket.com\/docs\/?p=20428"},"modified":"2021-07-23T05:47:15","modified_gmt":"2021-07-23T09:47:15","slug":"how-to-display-newsletter-popup-manually","status":"publish","type":"post","link":"https:\/\/plumrocket.com\/docs\/magento-newsletter-popup\/v4\/devguide\/display-manually","title":{"rendered":"How to Display Newsletter Popup Manually"},"content":{"rendered":"\n<p>In order to display <a href=\"\/magento-newsletter-popup\">Magento 2 Newsletter Popup<\/a> manually &#8211; you will have to perform the following steps:<\/p>\n\n\n\n<h3>Select &#8220;Display Popup Method&#8221; = &#8220;Manually&#8221; in your Magento 2 backend as shown below:<\/h3>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"\/docs\/wp-content\/uploads\/2020\/05\/Magento_2_newsletter_popup_developer27s_guide.jpg\" target=\"_blank\" rel=\"noopener noreferrer\"><img src=\"\/docs\/wp-content\/uploads\/2020\/05\/Magento_2_newsletter_popup_developer27s_guide.jpg\" alt=\"Magento 2 newsletter popup developer\"\/><\/a><\/figure>\n\n\n\n<h3>&#8220;Load&#8221; and &#8220;Show&#8221; newsletter popups using the following JavaScript methods below:<\/h3>\n\n\n\n<p>There are two available methods: .load() and .show(). &#8220;Load&#8221; method allows to load newsletter popup for Magento 2 content from server in background without displaying it. Then &#8220;Show&#8221; method will display the popup once it&#8217;s loaded.<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-javascript\">.load()<\/code><\/pre><\/div>\n\n\n\n<p>Load popup without any arguments. This method is executed automatically when the extension is initialized.<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-javascript\">.load([id][, callback ])<\/code><\/pre><\/div>\n\n\n\n<p>Load popup by specified newsletter popup ID. There is no need to check if the popup has been already loaded. This method will not load the same popup twice. You can find popup ID by going to your magento back-end, then Plumrocket -&gt; Newsletter Popup -&gt; Manage Newsletter Popups -&gt; column &#8220;ID&#8221;.<\/p>\n\n\n\n<p>If supplied, the callback is fired once the newsletter popup is loaded. The callback passed to .load() is guaranteed to be executed after the DOM is ready, so this is usually the best place to attach all other events and run other JavaScript code. It is hard to predict the overall load time of the newsletter popup from server and therefore we strongly recommend to use callback function. If the popup is already loaded on page then the callback will be executed immediately.<\/p>\n\n\n\n<p><strong>callback: <span style=\"color:#369\">function([<em><span style=\"color:#693\">bool<\/span><\/em> status][, <em><span style=\"color:#693\">bool<\/span><\/em> just_loaded])<\/span><\/strong><\/p>\n\n\n\n<p class=\"has-text-color\" style=\"color:#793862\"><strong><em>Parameters<\/em><\/strong><\/p>\n\n\n\n<p><strong>status<\/strong> \u2014 returns &#8220;true&#8221;, if the popup is available to be displayed, otherwise returns &#8220;false&#8221;. <\/p>\n\n\n\n<p><strong>just_loaded<\/strong> \u2014 returns &#8220;true&#8221;, if the popup was just loaded during this function call, otherwise returns &#8220;false&#8221; if it was previously loaded on page.<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-javascript\">.show()<\/code><\/pre><\/div>\n\n\n\n<p>Display popup on the page after it was loaded with the .load() method. It&#8217;s an easy way to display popup without providing any arguments. If on the same page two popups are loaded &#8211; one using automatic &#8220;Display Popup Method&#8221; (such as &#8220;after the time delay&#8221; or &#8220;when leaving the site&#8221;) and the second one using the &#8220;manual&#8221; display method, then the automatically loaded popup will be displayed. If you have loaded two or more popups using the &#8220;manual&#8221; display popup method, then the first loaded popup will be displayed.<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-javascript\">.show([id][, callback ])<\/code><\/pre><\/div>\n\n\n\n<p>Display popup by specified newsletter popup ID. This newsletter popup must be previously loaded using the .load() method. If a popup with a different &#8220;ID&#8221; is currently displayed on the page while the .show([id]) is being executed, then the previous popup will be hidden and the requested popup is displayed instead. There is no need to check for overlapping popups.<\/p>\n\n\n\n<p><strong>callback: <span style=\"color:#369\">function([<i><span style=\"color:#693\">bool<\/span><\/i> status])<\/span><\/strong><\/p>\n\n\n\n<p class=\"has-text-color\" style=\"color:#793862\"><strong><em>Parameters<\/em><\/strong><\/p>\n\n\n\n<p><strong>status<\/strong> \u2014 returns &#8220;true&#8221;, if the popup exists and displayed on page, otherwise returns &#8220;false&#8221;.<\/p>\n\n\n\n<p><i>EXAMPLES:<\/i><\/p>\n\n\n\n<p>Example 1:<\/p>\n\n\n\n<p><strong>Let&#8217;s load &amp; display newsletter popup with ID=5 and output a message to the Web Console using our callback function:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-javascript\">&lt;script type=\"text\/javascript\">\n    prnewsletterPopup.load(5, function(status, just_loaded) {\n        if (just_loaded) {\n            console.log('Well done, Sir. The popup was just loaded.');\n            \/\/ alert('This is another successful newsletter load message!');\n            prnewsletterPopup.show(5);\n        }\n    }\n&lt;\/script><\/code><\/pre><\/div>\n\n\n\n<p>Example 2:<\/p>\n\n\n\n<p><strong>Load and display any available newsletter popup. Please note that the &#8220;.load()&#8221; method without arguments is not required, it is executed automatically when the extension is initialized.<\/strong><\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-javascript\">&lt;script type=\"text\/javascript\">\n    prnewsletterPopup.show();\n&lt;\/script><\/code><\/pre><\/div>\n\n\n\n<p>Example 3:<\/p>\n\n\n\n<p><strong>Load and display newsletter popup with ID=5 on link click<\/strong><\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-javascript\">&lt;script type=\"text\/javascript\">\n    prnewsletterPopup.load(5);\n&lt;\/script>\n&lt;a href=\"javascript:void(0);\" onclick=\"return prnewsletterPopup.show(5)\">\n    See Newsletter Popup\n&lt;\/a><\/code><\/pre><\/div>\n\n\n\n<p>Example 4:<\/p>\n\n\n\n<p><strong>In this example, we are trying to display any default newsletter popup on page (no matter what ID). If this attempt was unsuccessful, then we will try to load and show popup ID=3.<\/strong><\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-javascript\">&lt;script type=\"text\/javascript\">\n    prnewsletterPopup.show(function(status) {\n        if (status == false) {\n            prnewsletterPopup.load(3, function(status) {\n                prnewsletterPopup.show();\n            });\n        }\n    });\n&lt;\/script><\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In order to display Magento 2 Newsletter Popup manually &#8211; you will have to perform the following steps: Select &#8220;Display Popup Method&#8221; = &#8220;Manually&#8221; in your Magento 2 backend as shown below: &#8220;Load&#8221; and &#8220;Show&#8221; newsletter popups using the following JavaScript methods below: There are two available methods: .load() and .show(). &#8220;Load&#8221; method allows to &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/plumrocket.com\/docs\/magento-newsletter-popup\/v4\/devguide\/display-manually\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to Display Newsletter Popup Manually&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[286],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v17.2 (Yoast SEO v17.2) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Display Newsletter Popup Manually - Plumrocket Documentation<\/title>\n<meta name=\"description\" content=\"In order to display Magento 2 Newsletter Popup manually - you will have to perform the following steps: Select &quot;Display Popup Method&quot; = &quot;Manually&quot; in your\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/plumrocket.com\/docs\/magento-newsletter-popup\/v4\/devguide\/display-manually\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Display Newsletter Popup Manually\" \/>\n<meta property=\"og:description\" content=\"In order to display Magento 2 Newsletter Popup manually - you will have to perform the following steps: Select &quot;Display Popup Method&quot; = &quot;Manually&quot; in your\" \/>\n<meta property=\"og:url\" content=\"https:\/\/plumrocket.com\/docs\/magento-newsletter-popup\/v4\/devguide\/display-manually\" \/>\n<meta property=\"og:site_name\" content=\"Plumrocket Documentation\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-01T11:04:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-07-23T09:47:15+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/plumrocket.com\/docs\/wp-content\/uploads\/2020\/05\/Magento_2_newsletter_popup_developer27s_guide.jpg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Plumrocket\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Display Newsletter Popup Manually - Plumrocket Documentation","description":"In order to display Magento 2 Newsletter Popup manually - you will have to perform the following steps: Select \"Display Popup Method\" = \"Manually\" in your","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/plumrocket.com\/docs\/magento-newsletter-popup\/v4\/devguide\/display-manually","og_locale":"en_US","og_type":"article","og_title":"How to Display Newsletter Popup Manually","og_description":"In order to display Magento 2 Newsletter Popup manually - you will have to perform the following steps: Select \"Display Popup Method\" = \"Manually\" in your","og_url":"https:\/\/plumrocket.com\/docs\/magento-newsletter-popup\/v4\/devguide\/display-manually","og_site_name":"Plumrocket Documentation","article_published_time":"2021-07-01T11:04:50+00:00","article_modified_time":"2021-07-23T09:47:15+00:00","og_image":[{"url":"https:\/\/plumrocket.com\/docs\/wp-content\/uploads\/2020\/05\/Magento_2_newsletter_popup_developer27s_guide.jpg"}],"twitter_card":"summary_large_image","twitter_misc":{"Written by":"Plumrocket","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/plumrocket.com\/docs\/#website","url":"https:\/\/plumrocket.com\/docs\/","name":"Plumrocket Documentation","description":"Extensions docs, troubleshootings etc.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/plumrocket.com\/docs\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"ImageObject","@id":"https:\/\/plumrocket.com\/docs\/magento-newsletter-popup\/v4\/devguide\/display-manually#primaryimage","inLanguage":"en-US","url":"\/docs\/wp-content\/uploads\/2020\/05\/Magento_2_newsletter_popup_developer27s_guide.jpg","contentUrl":"\/docs\/wp-content\/uploads\/2020\/05\/Magento_2_newsletter_popup_developer27s_guide.jpg"},{"@type":"WebPage","@id":"https:\/\/plumrocket.com\/docs\/magento-newsletter-popup\/v4\/devguide\/display-manually#webpage","url":"https:\/\/plumrocket.com\/docs\/magento-newsletter-popup\/v4\/devguide\/display-manually","name":"How to Display Newsletter Popup Manually - Plumrocket Documentation","isPartOf":{"@id":"https:\/\/plumrocket.com\/docs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/plumrocket.com\/docs\/magento-newsletter-popup\/v4\/devguide\/display-manually#primaryimage"},"datePublished":"2021-07-01T11:04:50+00:00","dateModified":"2021-07-23T09:47:15+00:00","author":{"@id":"https:\/\/plumrocket.com\/docs\/#\/schema\/person\/38b360639b934d6c984ee4f3ffce7d20"},"description":"In order to display Magento 2 Newsletter Popup manually - you will have to perform the following steps: Select \"Display Popup Method\" = \"Manually\" in your","breadcrumb":{"@id":"https:\/\/plumrocket.com\/docs\/magento-newsletter-popup\/v4\/devguide\/display-manually#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/plumrocket.com\/docs\/magento-newsletter-popup\/v4\/devguide\/display-manually"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/plumrocket.com\/docs\/magento-newsletter-popup\/v4\/devguide\/display-manually#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Magento 2 Extensions","item":"https:\/\/plumrocket.com\/magento-extensions"},{"@type":"ListItem","position":2,"name":"Magento 2 Newsletter Popup","item":"https:\/\/plumrocket.com\/magento-newsletter-popup"},{"@type":"ListItem","position":3,"name":"Documentation","item":"https:\/\/plumrocket.com\/docs\/magento-newsletter-popup"},{"@type":"ListItem","position":4,"name":"v4","item":"https:\/\/plumrocket.com\/docs\/magento-newsletter-popup\/v4"},{"@type":"ListItem","position":5,"name":"Developer Guide","item":"https:\/\/plumrocket.com\/docs\/magento-newsletter-popup\/v4\/devguide"},{"@type":"ListItem","position":6,"name":"Display Manually"}]},{"@type":"Person","@id":"https:\/\/plumrocket.com\/docs\/#\/schema\/person\/38b360639b934d6c984ee4f3ffce7d20","name":"Plumrocket","image":{"@type":"ImageObject","@id":"https:\/\/plumrocket.com\/docs\/#personlogo","inLanguage":"en-US","url":"https:\/\/secure.gravatar.com\/avatar\/72392a92ae750c66560be284502b6676?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/72392a92ae750c66560be284502b6676?s=96&d=mm&r=g","caption":"Plumrocket"},"sameAs":["https:\/\/plumrocket.com\/docs"]}]}},"_links":{"self":[{"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/posts\/20428"}],"collection":[{"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/comments?post=20428"}],"version-history":[{"count":1,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/posts\/20428\/revisions"}],"predecessor-version":[{"id":22452,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/posts\/20428\/revisions\/22452"}],"wp:attachment":[{"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/media?parent=20428"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/categories?post=20428"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/tags?post=20428"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}