custom php code on pages posts widgets

Posted in: Newspaper
Post count: 6

I am trying to have some custom php code on text or htlm blocks but they dont work.
i have install also the plgin insert php.
Any reason?
Thanks a lot

Post count: 22421

Hello,
Please provide more details as to what you want to implement and where. The visual composer raw html elements do not accept php. This has to be implemented in the theme files.
About your plugin, we have not tested it and we cannot say for sure if it is compatible with our theme.
Thank you!

Post count: 6

i just want to write some code in php.
example


<?php
$user_id = get_current_user_id();
if ( is_user_logged_in() ) {
  if ( $user_id == 2 || $user_id == 4) {
    <h3>display content for user ID=2,4</h3>
  } elseif ( $user_id == 1003 || $user_id == 1005 || $user_id == 1006 ) {
    display user_id = 3,5,6 content
  } else {
    display other user_id content
  }
} else {
  display content for guests

}
?>

How can i do that.
i dont want to have a membership plugin. to heavy for little code.
thanks

Post count: 22421

Hi,
You will need to provide more details as to what you intend to do with the code and where it should display the content so we can point you to the correct file for the code implementation. There are different php files for different locations so please exemplify exactly what you intend to do.
Thank you!

Post count: 6

it will be display on a block with visual composer.
The content for each will be one or two small lines of text and a link.
nothing else.
thanks a lot.

Post count: 22421

Hi,
That’s the information we needed. In order to add code to a block, you can modify the specific file for every module (blocks are made up of modules): http://screencast.com/t/oIIZeKWbl4
You can verify which block uses which module here: http://screencast.com/t/yaKm2ihTvm
It might require a bit of css for positioning after you add the code.
I hope this helps.
Thank you!

Post count: 6

Hello.
I think i was not correct.
i am send you some screenshots.
It is just a text box in the first page of your nice demo site.
http://ionianet.iq-design.eu/newspaper/costom-php.fw.png
http://ionianet.iq-design.eu/newspaper/costom-php2.fw.png

demo site with real page …
http://ionianet.iq-design.eu/

Thanks a lot

Post count: 22421

Hello,
The text box does not accept php. It only accepts html. There is also a custom js box but that’s it. PHP can only be added to the theme files. There is no custom php box you can add code to. Sorry.
Thank you for your message.

Viewing 8 posts - 1 through 8 (of 8 total)
The forum ‘Newspaper’ is closed to new topics and replies.