We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Hide widgets | Forum

Topic location: Forum home » Support » General Questions
Marius
Marius Nov 5 '19



Hello,


How can i hide widgets for mobile version? 


Thanks in advance.

OW-Ghost
OW-Ghost Nov 5 '19


  • Goto /ow_plugins
  • go to the plugin that use the widget you want remove
  • inside the plugin folder Open/Edit activate.php
  • Search for PLACE_INDEX or PLACE_MOBILE or something like that


here is a code example:


 $placeWidget = $widgetService->addWidgetToPlace($widget, BOL_MobileWidgetService::PLACE_MOBILE_INDEX); 


uncomment or delete the line that place the widget in mobile version should working


not forget inactivate and then activate the plugin after changes

The Forum post is edited by OW-Ghost Nov 5 '19
Marcus
Marcus Nov 5 '19
In admin panel access mobile page settings click on widget settings gear like symbol and choose restrict view. 
The Forum post is edited by Marcus Nov 5 '19
Marius
Marius Nov 5 '19



Hello Skadate Sweden,


I tried, but it also disappears from the mobile version and the desktop version.

I want only Main page.  




Hello Marcus , i have a theme , not work panel.




The Forum post is edited by Marius Nov 5 '19
dave Leader
dave Nov 5 '19

Quote from Skadate Sweden


  • Goto /ow_plugins
  • go to the plugin that use the widget you want remove
  • inside the plugin folder Open/Edit activate.php
  • Search for PLACE_INDEX or PLACE_MOBILE or something like that


here is a code example:


 $placeWidget = $widgetService->addWidgetToPlace($widget, BOL_MobileWidgetService::PLACE_MOBILE_INDEX); 


uncomment or delete the line that place the widget in mobile version should working


not forget inactivate and then activate the plugin after changes


Be careful with commenting out or deleting activation lines of code, just modifying the code will cause an error as the item is still in the database record.  If you are going to do it that way (not recommended) then be sure to remove the db record(s) as well so that next time you activate the plugin you dont get a DB error. 


There are two different classes for pages, one for the desktop and one for mobile.  The desktop is CTRL and the mobile is MCTRL


If you are speaking of a 3rd party plugin then youll have to either contact the developer and if that is not possible then i believe you can remove the mobile menu item in admin/mobile settings.


So you want to hide the plugin widget but not the plugin menu item, is that correct?   What plugin are you referring to?

The Forum post is edited by dave Nov 5 '19
Marius
Marius Nov 6 '19



Hello dave,



on mobile ( Main ), I want to hide these widgets - see attach (for example)

Attachments:
  main-page.PNG (1644Kb)
Marcus
Marcus Nov 6 '19
Take a look here...


Marius
Marius Nov 6 '19




@Marcus


Yes, but not work with mobile theme ( WhatsApp theme ) .

Marius
Marius Nov 6 '19



In attach , codes widgets ... but  how can hide widgets for mobile  ? i write in customize css, but hide on desktop and mobile ... I need  hide widgets only on mobile


sorry for my english. 

Attachments:
  ow_dnd.png (55Kb)
OW-Ghost
OW-Ghost Nov 6 '19
Can you show what line you comment out or deleted when "desktop widget" was gone?


PLACE_MOBILE_INDEX is means the widget are placed on mobile index for example.


Did you remove another line? or only this line?


Maybe i not sure what you goal is?

The Forum post is edited by OW-Ghost Nov 6 '19
Marius
Marius Nov 6 '19


Skadate Sweden,



Oh, yes,  i remove PLACE_INDEX 


 PLACE_MOBILE_INDEX or PLACE_MOBILE , not appears   :(





 

Attachments:
  blogs.PNG (2222Kb)
dave Leader
dave Nov 6 '19
in your css try using a filter such as @media with a trigger of screen size which should only effect mobile devices.


see here  


https://stackoverflow.com/questions/6370690/media-queries-how-to-target-desktop-tablet-and-mobile



Marius
Marius Nov 6 '19



@dave


Yeeees! :)  Work ! Thank you very much ! 



solution:


@media (max-width: 992px)  

dave Leader
dave Nov 6 '19
Yayyyyyyyyyyyy :)   glad it worked... :)
OW-Ghost
OW-Ghost Nov 7 '19
Glad you was solve it :)


i think some css elements should not bee in px and i not sure why oxwall insist use it. it is not mobile friendly.


but that is another story...

The Forum post is edited by OW-Ghost Nov 7 '19
dave Leader
dave Nov 7 '19

Quote from Skadate Sweden Glad you was solve it :)


i think some css elements should not bee in px and i not sure why oxwall insist use it. it is not mobile friendly.


but that is another story...

I agree but it depends how you use px, % percent should be used as the standard, but in some cases like this filter px can be used without negative effects because it is a static filter value.
The Forum post is edited by dave Nov 7 '19
OW-Ghost
OW-Ghost Nov 7 '19
i agree in this case it does not mather 


i hope plugin developers will use % in future plugin, theme projects and not use px


And there should bee a standard for this...

The Forum post is edited by OW-Ghost Nov 7 '19
Marius
Marius Nov 9 '19



A new question:


How can i hide widgets for desktop version  ?  I need for hide widgets only on desktop and tablet. 


dave Leader
dave Nov 10 '19
Actually after some research there is a function already for each. 


isDesktop()    and  isMobile()   


use them like this example in php



if(isDesktop())

{

   //do something

 }


if(isMobile()){

  // do something

 }


or


if(isDesktop())

{

   //do something

 }else{

           //has to be mobile so do something for mobile

          }// close else


I removed the ternary example as it would not work as well.

The Forum post is edited by dave Nov 10 '19
Marius
Marius Nov 11 '19




Hello @dave,



Thank you very much ! Is perfect !


this code :


if(isDesktop())

{

.ow_dnd_widget.admin-5dc732bae39bd,  {

    display: none;}

 }


if(isMobile()){

 .ow_dnd_widget.admin-5dc732bae39bd,  {

    display: yes;}

}


The Forum post is edited by Marius Nov 11 '19
Pages: 1 2 »