$60 Template Contest (need done ASAP)

I need a template like this, but something elegant and nice. Colors would be ideal as maybe black and grey. However, nice looking. We can still use the logo (if you want to use the paint bucket to change the color etc).


unreal 4 – UE4 – custom template can only start with blueprints

I tried making a custom template for UE4 to help save some time during gamejams.

I follow this tutorial:


It works alright, even though some minor things don’t work, like saving custom folder colors. But what really bothers me is this:
BP only?

Normally, the options are Blueprint and CPP. I tried making a new template with a different config file, but nothing changes. Is there a way to fix it?

theming – In my Simplenews twig template how do I get the URL of the page I am emailing?

When a single test newsletter is sent, Drupal provides me with the expected URL as follows:

{% set foo = url('<current>') %}
<p class="link-to-page">
<a href="{{ foo|render|replace({'simplenews':  ""}) }}">{{ 'You can view this news article in your web browser' }}</a>

Or by using the trim Twig function

But when sending the actual newsletter issue to subscribers, the batch process causes the url(‘current’) to provide a batch url like https://my-site.uk/batch

How can I obtain the one I want (to direct newsletter recipients to the page). Will a preprocess theme function see the same url values as twig or can I reliably capture the node’s real URL there Somehow?

8 – How to place a plugin block to twig template without any contributed module?

I am using Drupal 8. Have created a custom module, added custom block “LskyTestVideo”, created a new page template with its own controller (“LskyOpenTokTestController”). In LskyOpenTokTestController::index action I rendered test-video-page.html.twig . Inside this page I need to place LskyTestVideo block.Here my code:

class LskyOpenTokTestController extends ControllerBase {

public function index() {
$block_manager = Drupal::service('plugin.manager.block');

$config = ();
$plugin_block = $block_manager->createInstance('lsky_test_video', $config);

$access_result = $plugin_block->access(Drupal::currentUser());

if (is_object($access_result) && $access_result->isForbidden() || is_bool($access_result) && 
!$access_result) {
  return ();
$render = $plugin_block->build();

return (
  '#theme' => 'open_tok_test_video_page',
  '#attached' => (
    'library' => (
  '#test' => $render,


Here test-video.html.twig

    <div class="test-video-block">{{ test }}</div>

When the page is rendered, it returns 0.
How I can place a custom plugin block inside twig template. Thanks.

8 – How to insert form into existing page template

Working in D8, I am trying to insert a form into an already created page/template file.

I am using webforms, and on the webform submission page (that lists the submission details), I am trying to insert a custom form to do some additional stuff. I already have the form generated, but I cannot find the correct way to insert the form into the template/page.

I tried using Drupal::formBuilder()->getForm(form_name) in the twig template where I wanted it, but Drupal didn’t like that.

I then tried to use hook_page_bottom and hook_page_top, but that quite literally attaches it to the very top of the page, or very bottom of the page (outside of the bounds of the theme/template), not where I want it to be.

I am already overriding the template using the naming convention webform-submission–webform-machine-name.html.twig.

I am assuming since you can override the default templates for webform submissions, that the webform module implements hook_theme or some other similar hook. Is there a way I can hook into this hook and pass the form off as a variable, then just render it in the actual template using {{ form }}, or do I need to create my own override and pass both the submission data and the form data into it?

I miss the days when I could just use $form = drupal_get_form(); and print render($form); inside of the template exactly where I wanted it.

Download SharePoint Online built-in template?

I know that, with custom scripting enabled, you can save a SharePoint Online site as a template and then download the .wsp solution to your computer. I was wondering if this was possible with a built-in template, such as STS#0 or WIKI#0?

object oriented – Can other behavioral OOP design patterns be expressed in terms of Strategy and Template Method Patterns for behaviour parameterization?

I’m studying OOP design patterns in a solution-oriented way which I mean not concentrating just one pattern but with a comparative analysis like their combined or hybrid usages and equivalents in dynamic languages or in functional languages.

As the GoF grouping name behavioral patterns implies, this patterns are for behavior parameterization by utilizing single method dynamic dispatch in terms of polymorphism that OOP languages provides inherently AFAIK. I assume Strategy pattern as the main form of this mechanism and Template method pattern as its derivation which also keeps common code. Is that reasoning right? Can we approach polymorphism in OOP in this way?

If we think outside of OOP there are higher order functions and lambda functions in dynamic languages and functional languages or mix of them. I think that these languages provides only a few patterns/constructs in contrast to the GoF catalog which I map them to Strategy and Template Method Patterns in essence.

With this perspective, I have analyzed other behavioral patterns and then this question can’t get out of my mind. Even if it looks general but I think I’ve tried to be specific, I’m taking the risk of asking here.

Can we do the same job with Strategy or Template patterns instead of Command, Chain of Responsibility or Decorator(Structural but let's assume in this group) for an example in more or less finer design?

Note: I’m not trying to generalize so for example I know Visitor pattern is out of this scope since it solves the expression problem.

Custom post type archive not using custom template

I’m trying to create an index page for some project CPT I make. So basically it’s similar to this question, only that I’ve created the CPT in a separate plugin folder.

Following the accepted answer, this is the code from my plugin folder:

function register_my_cpt()
    $labels = array(
        'name' => 'Projects',
        'singular_name' => 'Project',
        'add_new' => 'New Project',
        'add_new_item' => 'Add New Project',
        'edit_item' => 'Edit Project',
        'new_item' => 'New Project',
        'view_item' => 'View Project',
        'search_items' => 'Search Project',
        'not_found' =>  'Project Not Found',
        'not_found_in_trash' => 'No Projects Found in Trash'

    $args = array(
        'labels' => $labels,
        'has_archive' => true,
        'public' => true,
        'hierarchical' => false,
        'supports' => array(
        'rewrite' => array('slug' => 'projects'),
        'show_in_rest' => true

    register_post_type('my_project', $args);

add_action('init', 'register_my_cpt');

function get_my_cpt_template($template) {
    global $post;

    if ($post->post_type == 'my_project') {
        $template = dirname( __FILE__ ) . '/archive-my_project.php';
    return $template;

add_filter( 'archive_template', 'get_my_cpt_template' );
<h2> Just for testing. This is from the archive-my_project.php file. </h2>

But after I activate the plugin and go to localhost/projects/, the page seems still using index.php as its template, and hence returning an empty page.

To isolate the issue, I’ve tried modifying my index.php so that it uses wp_query to specifically retrieve the project type posts and it does display the CPT posts fine.

This question seems suggesting adding taxonomy to the CPT. In my case I don’t need any taxonomy for the project post type.

What am I missing here? Thanks!

php – How to optimize code in a custom wordpress page template?

I’m pretty new to php coding, but i know wordpress for a long time. Also experimenting with bootstrap. I created a new Page Template and modified it a bit. What I’m looking for is to optimize this php code:

<div class="row">
<div class="col kb_landing_left">
        global $post; 
        $post = get_post(56); 
        get_template_part( 'template-parts/content', 'page', get_post_format() );
<div class="col -sm-6">
    <div class="row">
        <div class="col kb_landing_right">
        global $post; 
        $post = get_post(1); 
        get_template_part( 'template-parts/content', 'page', get_post_format() );

    <div class="row">
        <div class="col kb_landing_right">
        global $post; 
        $post = get_post(3); 
        get_template_part( 'template-parts/content', 'page', get_post_format() );
    <div class="row">
        <div class="col kb_landing_right">
        global $post; 
        $post = get_post(2); 
        get_template_part( 'template-parts/content', 'page', get_post_format() );

As you can see, it’s calling for 4 specific post IDs, since i want them to appear on my homepage in a bootsrap grid. I guess this could be done better by using an array?

Any suggestion is very much appreciated! Stay healthy!

performance – Particle Swarm Optimization template

I am trying to create a PSO algorithm template for my project. I’ve decide to make the Swarm as separate type and PSO class that computes the algorithm. For this program, the intention is to minimize the sphere function, as the result is expected to be close to 0. I am seeking advice in how should I improve my code so that it is more efficient and scalable for my future use. Furthermore, I tried to add unit testing to one of the function, but I really doubt that is the proper way. A snippet of the Swarm type is as follow

struct Swarm{
  const int number_of_particles = 1;
  struct Particles{
    std::vector<T> X;
    std::vector<T> V;
    std::vector<T> P_BEST_X;
    T P_BEST_O = (T)inf;
  std::vector<T> G_BEST_X;
  T G_BEST_O = (T)inf;
  std::vector<Particles> particles;


  Swarm(const int& nVar, const int& number_of_particles)
      : number_of_particles(number_of_particles){
    for(auto it = particles.begin(); it != particles.end(); ++it){
      it->X.resize(nVar, 0.0);
      it->V.resize(nVar, 0.0);
      it->P_BEST_X.resize(nVar, 0.0);
      it->P_BEST_O = inf;
    G_BEST_O = inf;
    G_BEST_X.resize(nVar, 0.0);

The following Github repository contains the remaining code. The snippet is excerpted from pso.h. I deeply apologize in case my code is really horrible.