0

Is it possible in Magento 2 to create a new cms block(using widget) with content of an existing block, and admin can change the images, links and text of new block????

Actually, I need a template(widget), and it should be called in different pages. For different pages, I need to change the template's images, text and links. For example, I have a cms block for showing these images on homepage

enter image description here

Now, I need the same block for some other page, but I need options to change images(using image uploader), texts and links... Any help will be appreciated... Thanks

4
  • Can you please explain/elaborate ? Sep 13, 2016 at 9:55
  • @Arun, I have edited my question. Please check...
    – Hima Mohan
    Sep 13, 2016 at 12:49
  • is the content dynamic or static ? Sep 14, 2016 at 5:12
  • content is dynamic.
    – Hima Mohan
    Sep 14, 2016 at 5:17

1 Answer 1

0

You can call a phtml template in you static block and write you logic in the template file

Create a block with content

{{block class="Magento\Framework\View\Element\Template" template="Magento_Theme::html/dynamic-images.phtml"}}

then create a template file dynamic-images.phtml under \app\design\frontend\<Vendor>\<Theme_Name>\Magento_Theme\templates\html

and write you dynamic code in dynamic-images.phtml.

don't forget to clear cache (php bin/magento cache:clean) every time you make changes to dynamic-images.phtml.

I hope you know how to create a widget.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.