Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
1.7k views
in Plugins by

Only on the front page I wanna display some HTML content. Something that admin can easyly insert using a Wysiwyg editor

1) is there a plugin for it? or the q2a core support is just out of the box(not sure if it does)

 

2) If not anything availabel, how can i do it?

 

Thank you in advance

 

to this:

Q2A version: qa 1.63 dev

3 Answers

+1 vote
by
selected by
 
Best answer

There is a well known plugin from Scott to place HTML that way (http://github.com/svivian/q2a-widget-anywhere). If I recall correctly, it is possible to place HTML in that position (among many others). Also it should be possible to select different sections to place it.

Now, extending amiya's answer, you can add HTML to your HOME if you check for the qa_request() value, regardless of which one your home is (the activiy section or the QA section).

function page_title_error() {
  if (qa_request() === '') {
    $this->output('<div>Some HTML here</div>');
  }
  qa_html_theme_base::page_title_error();
}
 
You can add that to a layer plugin or to your qa-theme.php file too. Of course, if the function is already defined in your theme file you'll have to merge it.
 
PS: I think you can't use the WYSIWYG editor in Scott's plugin. But you can use any WYSIWYG editor from any site and get the HTML code and paste it there (or in the output of the function). For example, here is CKEDITOR with the Source button enabled: http://htmleditor.in Just copy it and paste it.

 

by
Thank you pupi
+2 votes
by

you can do using a layer . you need to override this function - 

function page_title_error()
{
$this->output('<div><p>Your HTML Content here </p></div>');
qa_html_theme_base::page_title_error();
}
 
Hope this helps 
 
Thanks 
Amiya 
by
Thank you! worked! but would there be a way to limit it to homepage (not hot questions etc)
also how to integrate wysiwyg?
+2 votes
by
edited by

If you are using CKEditor, try combination below.

I made all static pages of my site with combination of (1) + (3).

Usage: Add "wcontent" in "Name list of TEXTAREA" option of "* for admin" plugin.

Example of contents editing page of WA:

Inline (floating) editing:

 

I think that WA is the superior work of Scott.

by
Thank you sama
by
for some reason   CKEditor4 + CKEditor4 for admin did not work with 1.7 dev!
my wysiwyg editor becomes plane text editor!
by
Thanks for your report. I tried V1.7 dev (today version).  In my environment, some installation warnings were displayed. And, default editor did not work, too.

Installation warnings:
Warning: array_fill() [function.array-fill]: Number of elements must be positive in ***\qa-include\qa-db-install.php on line 541
Warning: array_combine() expects parameter 2 to be array, boolean given in ***\qa-include\qa-db-install.php on line 541

Javascript error of default editor:
Uncaught TypeError: Cannot set property 'dir' of undefined

https://www.drupal.org/node/2284795
http://stackoverflow.com/questions/22350447

Because this version is for development, there will be still many issues. We should not use the development version that is not released formally.
by
Sure thank you, but the widget anywhere was still compatible and helped :)
...