4

I wonder if it is possible to display author name or created_by or created_by_alias in com_search results page.

In components/com_search/views/search/tmpl/default_results.php, this obviously wouldn't work :

    ....
<dd>
        <?php echo $result->created_by_alias; ?>
    </dd>
    <?php endforeach; ?>
7

You cannot do this with the default Search component without modifying the search plugin database query. This is considered a core hack, therefore not recommended.

Instead I'd suggest using Smart Search:

  1. Go to Plugins >> Smart Search, then enable it.
  2. Go to Modules >> Smart Search. Enable and assign to a page.
  3. Go to Components >> Smart Search >> Index.

Now that the initial steps are done, you should create a Template Override for the following file:

components\com_finder\views\search\tmpl\default_result.php

Once done, open the template override file:

templates\YOUR_TEMPLATE\html\com_finder\search\default_result.php

In here, you need to add the following code which will display the author:

<?php echo $this->result->author; ?>

Hope this helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.