plugins – publish_{$post_type} hook works only for posts and not for custom post types or pages

I’m trying to send push notification when any of posts, custom post types or pages is published. I’m getting enabled post types from the plugin settings and adding action via foreach loop in my class __construct method. The problem is that it only works for posts and not for any of custom post types or pages. Here is my function and action:

foreach ((array)get_option('PushPostTypes') as $postType) {
    add_action("publish_{$postType}",  array($this, 'doNewPostPush'), 10, 2);
}

public function doNewPostPush($id, $post) {
    $pushData = array(
        'title' => $post->post_title,
        'body' => strip_tags($post->post_content),
        'data' => array(
            'url' => trailingslashit(get_permalink($id)),
        ),
    );

    if (has_post_thumbnail($id)) {
        $pushData('image') = get_the_post_thumbnail_url($id);
    }
    
    $this->sendNotification($pushData);
}

get_option('PushPostTypes') is an array of post types that user choose, for example: array('post', 'page', 'custom_post');

Any idea why it only works for post and not for pages or custom post types?

pages – Every change made by “Author” role is going to “pending review”

I don’t know if this is an issue with the module https://wordpress.org/plugins/user-role-editor/, or this is an internal behavior of WordPress, but for some reason, every time a user with “Author” role makes an update in some page content, this page goes to “pending review” and I have (as Admin), to approve it.

How can I avoid this and let “Author” have its changes auto-approved?

woocommerce – Split taxonomies on different pages

I’m working on a Woocommerce website and created a new taxonomy activity. I’ve added that taxonomy to the post type Product.

So a Product can have one of the following activity:

  1. Museum
  2. Food & Drinks
  3. Attractions
  4. Guided tours

To show all the Products, I’ve created taxonomy-activity.php which already shows all the products that have an activity taxonomy.

But I have to have all the Products with taxonomy Guided tours on a seperate page. And all the others on the other page. So there will be 2 pages: One page will be called Guided tours which only shows the guided tours and the other is called Activities.

Is it correct to do this with the taxonomy-{slug}.php or should I create a new page. For example: page-guidedtours.php which loops through all the Product with Guided tours taxonomy. And the other page page-activities.php which loops through all the Products without Guided tours taxonomy.

Sidenote: I’m using the plugin FacetWP in order to show the Product and created filters. So the query is created with the plugin and then the list of products in shown with a shortcode.

My current query is:

<?php
return [
   "post_type" => [
   "product"
],
   "post_status" => [
   "publish"
],
   "posts_per_page" => "18",
   "orderby" => "title",
   "order" => "ASC",
];

I’m thinking about created 2 Facets. One facet that shows the Guided tours. So in this case I have to add the term Guided tours to the query. And then other facet without the term Guided tours.

⚠️ Why should you A/B Test your Landing Pages? | Proxies-free

“A satisfied customer is the best business strategy of all.” – Gregory Ciotti

Happy Customer = Successful Business :]

Want to know more strategies on how to keep your customers satisfied? Click here to learn more >>> JOIN IAMAFFILIATE NOW!!

⚠ Why should you A/B Test your Landing Pages?

✔A/B testing is fundamental to landing page optimization.
There are several things you might want to improve with a landing page test, all of which ultimately will lead you to the goal of improving your conversion rate.

Most commonly, marketers looking to learn one of the following insights from an A/B test:
☑ How to increase conversion rate – What design or copy changes drive more people to fill out the form — whatever that form is?
☑ How to increase sales – What design or copy changes drive more people to eventually make a purchase?

CONTINUE READING ON IAMAFFILIATE PREMIUM FORUM!

#thoughtoftheday #iamaffiliate #affiliatemarketing #marketing #digitalmarketing #affiliates #marketingstrategies #marketingtips #affiliateguides #affiliateforum #affiliatetips #onlinemarketing #facebookmarketing #facebookads #googleads #ecomtips #ecommerce

 

web server – Nginx separating requests for static pages vs rails app

We currently have nginx sitting in front of our puma app servers (serving rails apps). Recently we’ve separated out ‘marketing’ pages into it’s own repo and app.

So essentially we have static content served by app deploy on the netlify, but we have our rails app take over once users are logged in.

Any advice how to set this one up?
So we use one domain for both of these? Initially we were thinking to create a subdomain for static content like (static.mydomain.com) and serve everything from there, but that approach has major downsides (domain and subdomain don’t have the same SEO).

Can nginx do some kind of url rewrite so our static app on netlify appears under our domain? Or has anyone solved this problem differently?

Create an effective Facebook business Page for $5

Create an effective Facebook business Page

Hey, are you looking for create a fb business page or Fan page? It is only right place where you can solve your problem. I will Create fb Business Page Or Fan page. A fb page is very important for all types ofbusiness., It helps to promote a business to all. It helps a business to achieve the top position, I can complete your web site, product, service, etc by

making a FB business page. I will produce a professional fb business

page. If you have any question about this information please ask me friendly i will help you.

Ialways committed to give you the best services sir, I always believe that

honesty is the best policy.
My Service

  • Creating a Facebook page or Facebook fan page.
  • Develop a full business page mobile phone and PC friendly.
  • Design business plan
  • Creating an online store and e-commerce .

Why order this gig?
1. On-time delivery

2. High-quality service

3. 100% satisfaction guaranteed

.

2013 – Duplicate or Copy publishing pages (Pages document library)

I have taken a look into the Mavention Duplicate Page (no-code Sandboxed WSP) link.

Found out that there is only a js file inside. Tried putting the content of the js file into a script editor webpart in my Pages document library and it’s working.

Actually there is no need to deploy the wsp into solution gallery.

enter image description here

eval(function(p, a, c, k, e, d) {
debugger;
e = function(c) {
    return (c < a ? '' : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36))
};
if (!''.replace(/^/, String)) {
    while (c--) {
        d(e(c)) = k(c) || e(c)
    }
    k = (function(e) {
        return d(e)
    });
    e = function() {
        return '\w+'
    };
    c = 1
};
while (c--) {
    if (k(c)) {
        p = p.replace(new RegExp('\b' + e(c) + '\b', 'g'), k(c))
    }
}
return p
}('(2(){I(L(h)==='D'||h===16){n}h.e(2(){0 v=2(){0 5={};5.U='w';5.V=Q;5.E={};5.E.P=2(1){n A(1)};I(L(G)!=='D'){G.19.12(5)}};0 A=2(1){0 c=13(1);11(1,2(){0 6=p 10(c+'-r');q(1,6);6.Y()});0 7=();7.e('<s Z='+14(c+'-15')+' 1a="t-u-r t-u-X">');7.e(17(1,1.8,1.1b));7.e('</s>');n w.W(c,7.T(''))};0 q=2(1,6){R(1,6);0 S=1.8;6.18(p 1w({1E:'o',1F:2(1G,1D){0 l=3.4.i.1C('1y f...',1z);0 9=1.8.x.1A('.y',p 1B().1H('1I')+'.y');0 j=3.1Q.1c();0 z=j.1O();0 d=z.1P(1.8.x);d.1N();d.1J(9);d.1K();j.1L(F.O(H,2(B,m){3.4.i.C(l);0 b=3.4.g.J('o f:','1M 1x 1j 1k: <a 1l="'+9+'">'+9+"</a>",k);3.4.g.K(b,'1i');0 M={'1h':1,'1d':k};1e(M,3.4.1f.1g)}),F.O(H,2(B,m){3.4.i.C(l);0 b=3.4.g.J('o f:','1m 1n 1t 1u 1v 1s 1r 1o f: <N>'+m.1p()+'</N>',k);3.4.g.K(b,'1q')}))}}))};v()})})();', 62, 115, 'var|renderCtx|function|SP|UI|templateOverride|calloutActionMenu|ecbMarkup|CurrentItem|path||sid|calloutID|file|push|page|Status|_spBodyOnLoadFunctions|Notify|context|true|nid|eventArgs|return|Duplicate|new|calloutOnPostRenderCustomTemplate|actions|span|js|callout|registerDuplicatePageAction|Callout|FileRef|aspx|web|calloutRenderCustomFooterTemplate|sender|removeNotification|undefined|Templates|Function|SPClientTemplates|this|if|addStatus|setStatusPriColor|typeof|evtAjax|em|createDelegate|Footer|850|CalloutOnPostRenderTemplate|listItem|join|BaseViewID|ListTemplateType|GenerateDefaultFooter|ecbActionDownArrow|render|id|CalloutActionMenu|AddPostRenderCallback|RegisterTemplateOverrides|GetCalloutElementIDFromRenderCtx|StAttrQuote|ecbMenu|null|RenderECBinline|addAction|TemplateManager|class|CurrentFieldSchema|get_current|csrAjaxRefresh|AJAXRefreshView|DialogResult|OK|currentCtx|green|duplicated|as|href|The|following|the|get_message|red|duplicating|while|error|has|occured|CalloutAction|successfully|Copying|false|replace|Date|addNotification|action|text|onClickCallback|event|format|yyyyMMddHHmmss|copyTo|undoCheckOut|executeQueryAsync|Page|checkOut|get_web|getFileByServerRelativeUrl|ClientContext'.split('|'), 0, {}))

Staging environment for pages only

I am currently developing a news-style website. I am using Softaculous to build changes in a staging environment and then pushing to live when they are ready.

Ideally, however, I would like to stage changes to the site’s pages while simultaneously keeping the production site updated with articles (ie, posts and images).

Changes I would like to stage, besides additional/edited pages, would be changes to themes and plugins. Ie, everything except posts an d the media library.

Is there any easy way to achieve this?

From what I can tell Softaculous doesn’t so much as merge as simply push from staging to production — so if I were to update any posts on product and then push to live, those posts would get overwritten/removed after the site updates.

Thank you in advance!