Trying to accomplish the following. Any help/advice is greatly appreciated.
I have multiple domain names (e.g., site1.com, site2.com, site3.com).
I need each domain to display the same content
But show a different wordpress theme.Plugins are same...etc
Thank you
With regards to accessing the same site over different domains; although there may be recommendations against it as a general practice, you can add the following lines to your wp-config.php file:
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST']);
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST']);
With that, you're basically saying to Wordpress 'treat whatever domain that's pointing this way as my base URL'.
For switching themes accordingly, you could try something like this in your functions.php (untested):
if (strpos($_SERVER['HTTP_HOST'], 'site2.com') !== FALSE) {
add_filter('stylesheet', 'siteTwoTemplate');
add_filter('template', 'siteTwoTemplate');
}
function siteTwoTemplate() {
$themeToGrab = 'site2theme';
$themeList = get_themes();
foreach ($themeList as $theme) {
if ($theme['Name'] == $themeToGrab) {
return $theme['Stylesheet'];
}
}
}
There may well be more efficient/safer means of achieving this, but it should do what you're after.
Related
if (response.success) {
this.redirectURL = response.data.loginUrl;
// this.URL='http://'+location.host+'/login'+'/'+this.redirectURL;
this.router.navigate(['/login?token=', this.redirectURL]);}
Here is the code ,it should move me to cognito page but its moving to login page in angular I am not sure where I am wrong
use +(plus) instead of ,(comma)
this.router.navigate(['/login?token='+this.redirectURL]);}
If you want to use query params, you can also adopt this approach.
this.router.navigate(['login'], { queryParams: { token: 20 } });
Most likely the reason behind the issue you are facing is that the comma-separated navigation turns to slash-separated one, e.g.
let redirectURL = '1234'
this.router.navigate(['/login?token=', redirectURL])
// this line above results to /login?token=/1234'
So in order to avoid that you should either use the solution that I suggest or the one mentioned by abhishek sahu, where the usage of + for concatenation is encouraged.
I was wondering if there is a good practice on how to write your HTML code in order to get better Sentry.io breadcrumbs inside of the issues.
It's not possible to identify the elements that the user has interacted and I think using CSS class or IDs for it is not the ideal - although we can customize the breadcrumbs, looks like it's not a good practice to get the text inside the tag as per some issues found on Sentry Github repository.
I was thinking about aria-label, does anyone has any advices on it?
Right now is very hard to understand the user steps when reading the breadcrumbs.
This can be solved using the beforeBreadcrumb hook / filtering events.
Simply add
beforeBreadcrumb(breadcrumb, hint) {
if (breadcrumb.category === 'ui.click') {
const { target } = hint.event;
if (target.ariaLabel) {
breadcrumb.message = target.ariaLabel;
}
}
return breadcrumb;
}
... to your Sentry.init() configuration.
Sentry.init({
dsn:...
Resulting in something like this:
Sentry.init({
dsn: '....',
beforeBreadcrumb(breadcrumb, hint) {
if (breadcrumb.category === 'ui.click') {
const { target } = hint.event;
if (target.ariaLabel) {
breadcrumb.message = target.ariaLabel;
}
}
return breadcrumb;
}
});
More about this here: sentry.io filtering events documentation
I am trying to find a way to use alternative headers in Razor Web Pages without using two _SiteLayout pages, with each _SiteLayout rendering a different _header page.
I’m trying to achieve this - If the default.cshtml page is called use header-1, if any other page is called use header-2.
I have tried all sorts of different logic with no joy, including: IsCurrentPage, Request.QueryString, Request.Url; and CurrentPage.Name.
E.G.
#if ((Request.QueryString["Default"] == null))
{
#RenderPage("/shared/_header-1.cshtml")
}
else
{
#RenderPage("/shared/_header-2.chtml")
}
And
#{
var pageUrl = this.Request.Url;
}
#if (pageUrl = "http://mycompany/Default.cshtml/") {
#RenderPage("/shared/_header-1.cshtml");
}
else
{
#RenderPage("/shared/_header-2.cshtml");
}
Does anyone have a simple method to achieve this please?
Although, I spent a long time on this, not long after posting I found an answer thanks to: Erik Philips
Add to _SiteLayout:
#if (IsSectionDefined("customHeader"))
{
#RenderSection("customHeader")
}
else
{
#RenderPage("/shared/_header.cshtml")
}
Add to default page
#section customHeader{
This is custom header
}
The common header doesn't get called in the Default page, because customHeader is specified instead; whereas, all other pages use the normal header
I want to make the "red links" (links for uncreated pages) on a MediaWiki site to become plain text, save for people logged. Perhaps also make that them don't appear at all or only appear on different situations. You can "hide" them a bit with CSS, but I prefer to actually don't feature them.
You could use the LinkBegin hook to abort the link creation for page that do not exist. Something like this:
$wgHooks['LinkBegin'][] = 'ExampleExtension::exampleExtensionLinkBegin';
class ExampleExtension {
public static function exampleExtensionLinkBegin( $dummy, $target, &$html, &$customAttribs, $query, &$options, &$ret ) {
if ( $target->exists() ) {
return true;
} else {
$ret = $html;
return false;
}
} //exampleExtensionLinkBegin
}
edit: If you are not familiar with MW extension development, I recommend that you start by reading http://www.mediawiki.org/wiki/Manual:Developing_extensions and http://www.mediawiki.org/wiki/Manual:Hooks
If you know just a little bit of PHP, you should be able to follow that without any problems.
...I know how to establish short URLs (using .htaccess) that remove the "index.php" from URLs. Now my Wiki main page URL looks like www.site.com/wiki/Main_page. However, i want it to simply look like www.site.com/wiki/ . Is it possible to do this without heavy modifications to the source code?
Yes, this can be done now. The main trick is to tell MediaWiki what the canonical URL of your main page is. To have the main page in the domain root:
$wgHooks['GetLocalURL'][] = function ( &$title, &$url, $query ) {
if ( $title->isExternal() || $query != '' && $title->isMainPage() ) {
$url = '/';
}
};
See http://laxstrom.name/blag/2015/08/31/mediawiki-short-urls-with-nginx-and-main-page-without-redirect/ for full details.