Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
fourday Posted October 29, 2020 Posted October 29, 2020 (edited) 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 October 29, 2020 by fourday
Morrigan Posted October 29, 2020 Posted October 29, 2020 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. fourday 1
fourday Posted October 30, 2020 Author Posted October 30, 2020 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.
Sonya* Posted October 31, 2020 Posted October 31, 2020 (edited) 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 October 31, 2020 by Sonya* fourday 1
Sonya* Posted October 31, 2020 Posted October 31, 2020 (edited) double Edited October 31, 2020 by Sonya*
fourday Posted October 31, 2020 Author Posted October 31, 2020 Thank you. I was able to make #2 work. Would be tedious to do for each record page if I have hundreds of records. But it would be good for the category pages. Appreciate response.
Recommended Posts