Please, how can I remove this link from my MediaWiki Special Page?
You need to override SpecialPage::addHelpLink() in your special page class. You could either add a different help link, or just not add one at all.
Check out
languages/i18n/en.json
Line [ 233 ]
I found it:
public function addHelpLink( $to, $overrideBaseUrl = false ) {
global $wgContLang;
$msg = $this->msg( $wgContLang->lc( $this->getName() ) . '' );//-helppage
if ( !$msg->isDisabled() ) {
$helpUrl = Skin::makeUrl( $msg->plain() );
$this->getOutput()->addHelpLink( $helpUrl, true );
} else {
$this->getOutput()->addHelpLink( $to, $overrideBaseUrl );
}
}
I'd just removed -helppage from SpecialPage Class.
Related
is there a way to put an external link on MediaWiki's footer?
I've tried to add in my localsetting.php this code:
$wgHooks['SkinTemplateOutputPageBeforeExec'][] = function( $sk, &$tpl ) {
$tpl->set( 'aboutus', $sk->footerLink( 'aboutus', 'aboutuspage' ) );
// or to add non-link text:
$tpl->set( 'footertext', 'Text to show in footer' );
$tpl->data['footerlinks']['places'][] = 'aboutus';
return true;
};
But this go to create a Mediawiki's page, and i want to add a link to a contact page. I've modified the MediaWiki:Aboutus and MediaWiki:Aboutuspage pages, but nothing, continue to remind me to a MediaWiki's page.
What do you put in "MediaWiki:Aboutus"? You've to actually create the html link.
Try this
$wgHooks['SkinTemplateOutputPageBeforeExec'][] = function( $sk, &$tpl ) {
$aboutusLink = Html::element( 'a', [ 'href' => $sk->msg( 'aboutus-url' )->escaped() ],
$sk->msg( 'aboutus-label' )->text() ) ;
$tpl->set( 'aboutus', $aboutusLink );
$tpl->data['footerlinks']['places'][] = 'aboutus';
return true;
};
Then on your wiki create the page "MediaWiki:Aboutus-url" and directly place the external link you want you use. Also create the page "MediaWiki:Aboutus-label" and place the text to show on the surface. This allows you to change the url and label by modifying that wiki page messages any time, just as it seems you wanted to do so. If you want to hardcode everything in LocalSettings.php however, then use this:
$wgHooks['SkinTemplateOutputPageBeforeExec'][] = function( $sk, &$tpl ) {
$aboutusLink = Html::rawelement( 'a', [ 'href' => 'https://stackoverflow.com/questions/59427663/modify-footer-in-mediawiki' ],
'Text to show as label' );
$tpl->set( 'aboutus', $aboutusLink );
$tpl->data['footerlinks']['places'][] = 'aboutus';
return true;
};
I'm using ACF together with the ACF Hook acf/load_value to add a custom HTML wrapper to the ACF value. I use then the ACFs to build an Elementor template (I'm using Elementor PRO).
The Template works and the values of ACFs are rendered, but the attribute I've added in the wrapper disappear
I've tried to change the priority of my filters, but it wasn't the problem. I 've also tried to look into the ACF settings, but seems that I cannot change this behavior just changing some settings.
This is the filter I made
if (!function_exists('my_acf_span_property')) {
function my_acf_span_property($value, $property) {
$value = '<span property="' . $property . '">' . $value . '</span>';
return $value;
}
}
if (!function_exists('my_acf_industry_value')) {
function my_acf_industry_value($value)
{
return my_acf_span_property($value, 'industry');
}
}
add_filter('acf/format_value/name=industry', 'my_acf_industry_value');
I made one filter for each ACF I need to change, this is only one as example.
I've tried to debug the filter changing return $value; to return htmlentities($value); in the function my_acf_span_property and the attributes are rendered in the frontend.
The output was expected to be <span property="industry">ACF value</span>
But wat is rendered is <span>ACF value</span>
It could be an Elementor problem?
Any Idea?
I solved with an action to allow the attributes in the posts
if (!function_exists('allow_property_attribute')) {
function allow_property_attribute() {
global $allowedposttags, $allowedtags;
$newattribute = "property";
$allowedposttags["span"][$newattribute] = true;
$allowedtags["span"][$newattribute] = true;
$allowedposttags["div"][$newattribute] = true;
$allowedtags["div"][$newattribute] = true;
$allowedposttags["p"][$newattribute] = true;
$allowedtags["p"][$newattribute] = true;
}
}
add_action( 'init', 'allow_property_attribute' );
It looks like was WordPress my problem, and not Elementor or ACF.
I want to add a simple code to all new post by default
I tried to used this code in .function.php (wpbeginner)
add_filter( 'default_content', 'my_editor_content' );
function my_editor_content( $content ) {
$content = "If you like this post, then please consider retweeting it or sharing it on Facebook.";
return $content;
}
I am using plugin named Shortcodes Ultimate
Code:
[su_spoiler title="Download The File" style="fancy" icon="chevron-circle"]Here[/su_spoiler]
I tried to normal use simple html and CSS code but it show the same error for both cases
https://i.stack.imgur.com/wgAs4.png
Try this -: wrap your code is a single quote as you are already using double quotes.
add_filter( 'default_content', 'my_editor_content' );
function my_editor_content( $content ) {
$content = '[su_spoiler title="Download The File" style="fancy" icon="chevron-circle"]Here[/su_spoiler]';
return $content;
}
How can I add the PARAMETERS to this WP function next_post_link().
add_filter ('next_post_link', 'new_next_post_link');
function new_next_post_link ($args) {
in_same_cat ??????
return $args;
}
I need to change it via FILTER cause I cant change it in the Theme. I tried this.
add_filter ('next_post_link', 'new_next_post_link');
function new_next_post_link ($args) {
$args = "Hello World";
return $args;
}
This works, so I need to know how to change "Hello World" into next_post_link('%link', 'Next post in category', TRUE);
Cheers,
Denis
you don't need to. the third parameter is in_same_cat (bool). by default it is set as false.
<?php next_post_link($format, $link, true); ?>
http://codex.wordpress.org/Function_Reference/next_post_link
Complete beginner here. I want to create a new tab on each page that has a custom action. When clicked, it takes you to a new page which has custom HTML on it along with the text or the original article.
So far I could create a new Tab and could give a custom action mycustomaction to it. I am pasting what I did so far here. Please let me know if I am using the correct hooks etc. and what is a better way to achieve this basic functionality.
So far with their docs I have done this:
#Hook for Tab
$wgHooks['SkinTemplateContentActions'][] = 'myTab';
#Callback
function myTab( $content_actions) {
global $wgTitle;
$content_actions['0'] = array(
'text' => 'my custom label',
'href' => $wgTitle->getFullURL( 'action=mycustomaction' ),
);
return true;
}
#new action hook
$wgHooks['UnknownAction'][] = 'mycustomaction';
#callback
function mycustomaction($action, $article) {
echo $action;
return true;
}
This gives me error:
No such action
The action specified by the URL is invalid. You might have mistyped the URL, or followed an incorrect link. This might also indicate a bug in the software used by yourplugin
What I was doing wrong:
$content_actions[‘0’] should simply be $content_actions[] (minor nitpick)
$content_actions is passed-by-reference, it should be function myTab( &$content_actions ) {}
mycustomaction() should do something along the lines of
if ( $action == ‘mycustomaction’ ) {
do stuff; return false;
}
else {
return true;
}
It should use $wgOut->addHTML() instead of echo
Thanks a lot everyone for your help!