Jump to content

Custom block on INDIVIDUAL records or categories in pages?


Recommended Posts

When I drag a block onto a database page, the result is global to all records and categories.  (every record in the database sees the same block).   I'd like to add a specific custom block (such as ads) to a specific record or category so it is targeted.   Is there a way to do this?   I've tried several times without success.

Thank you. 

Edited by fourday
Link to comment
Share on other sites

You would have to do this at the theme level unfortunately. So you can do it one of a few way depending on the block.

I normally do something like this:

[data-blockid="app_cms_Database_50o7otc74"] {
	display: none;
}
[data-pageid="ID#"] [data-blockid="app_cms_Database_50o7otc74"] {
	display: block;
}

You'd have to fine the identifiers for the blocks you are using specifically though.

Link to comment
Share on other sites

Thank you @Morrigan and @Sonya* for the replies.  Appreciate your time.

I'll do my best with your ideas.  🙂    I'm not a coder though.   I actually paid a developer to create a widget that would allow me to drag and drop a custom block onto individual pages but it did not work.   No matter what the input was, the software only showed a "1" .  He thought it might be a core issue.

So I guess I'll have to keep digging.  I worry about tweaking themes because software updates caused a problem with the custom theme I had last time.  

Link to comment
Share on other sites

You do not need to mess with your themes to place custom blocks on individual pages. These are simple IFs and it worth to try even if you are not a coder.

Example 1:

In your AdminCP create a custom block with manual HTML:

{{if strpos( \IPS\Request::i()->path, 'partner' ) !== FALSE}}
{advertisement="my_custom_ad"}
{{endif}}

This block would display an advertisement placed in custom location my_custom_ad on the page _http://yourdomain.com/partner

Then place the block with Block Manager where you would like to have it.

Example 2:

{{if strpos( \IPS\Request::i()->path, 'companies/cars' ) !== FALSE}}
{block="my_custom_block"}
{{endif}}

This block would display a custom block with the key my_custom_block on the page _http://yourdomain.com/companies/cars

Give it a try 😉

Edited by Sonya*
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...