Короткий ответ здесь заключается в том, что вам необходимо знать некоторые основы html, css, javascript и, возможно, php, в зависимости от точной функциональности и способа ее развертывания.
Длинный ответ, можно через html & css создать и оформить флажок. Вам понадобится js, чтобы текст зачеркнулся после щелчка. Если вы хотите сохранить проверенное состояние при перезагрузке страницы, вам нужно либо создать Cook ie, либо сохранить его в localStorage с помощью javascript. Если, конечно, вы не захотите сохранить его в базе данных, которая будет более безопасной для вашего сайта, но потребует работы с PHP и MySQL для отправки проверенного состояния и состояния перечеркивания в базу данных Wordpress.
Вот грубый флажок, который завершает основы того, что вам нужно
HTML:
<div class="wrapper">
<div class="container">
<label class="checkbox-label">
<input onclick="strikethrough()" type="checkbox" id="mycheckbox1" name="mycheckbox1" value="yes">
<span class="checkbox-custom rectangular"></span>
</label>
</div>
</div>
<div class="text">
<h2 id="changeText1">Hello World</h2>
</div>
CSS:
@import url('https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900');
body {
font-family: 'Roboto', sans-serif;
}
.card {
width: 50px;
margin: 0 auto;
clear: both;
display: block;
padding: 0px 0px;
border-radius: 4px;
}
.card::after {
clear: both;
display: block;
content: "";
}
.card .checkbox-container {
width: 100%;
box-sizing: border-box;
text-align:center;
padding: 10px 0px;
}
/* Styling Checkbox Starts */
.checkbox-label {
display: block;
position: relative;
margin: auto;
cursor: pointer;
font-size: 22px;
line-height: 24px;
height: 24px;
width: 24px;
clear: both;
}
.checkbox-label input {
position: absolute;
opacity: 0;
cursor: pointer;
}
.checkbox-label .checkbox-custom {
position: absolute;
top: 0px;
left: 0px;
height: 24px;
width: 24px;
background-color: transparent;
border-radius: 5px;
transition: all 0.3s ease-out;
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-ms-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
border: 2px solid #D4AF37;
}
.checkbox-label input:checked ~ .checkbox-custom {
background-color: #FFFFFF;
border-radius: 5px;
-webkit-transform: rotate(0deg) scale(1);
-ms-transform: rotate(0deg) scale(1);
transform: rotate(0deg) scale(1);
opacity:1;
border: 2px solid #D4AF37;
}
.checkbox-label .checkbox-custom::after {
position: absolute;
content: "";
left: 12px;
top: 12px;
height: 0px;
width: 0px;
border-radius: 5px;
border: solid #D4AF37;
border-width: 0 3px 3px 0;
-webkit-transform: rotate(0deg) scale(0);
-ms-transform: rotate(0deg) scale(0);
transform: rotate(0deg) scale(0);
opacity:1;
transition: all 0.3s ease-out;
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-ms-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
}
.checkbox-label input:checked ~ .checkbox-custom::after {
-webkit-transform: rotate(45deg) scale(1);
-ms-transform: rotate(45deg) scale(1);
transform: rotate(45deg) scale(1);
opacity:1;
left: 8px;
top: 3px;
width: 6px;
height: 12px;
border: solid #51B4A6;
border-width: 0 3px 3px 0;
background-color: transparent;
border-radius: 0;
}
#changeText1 {
text-align:center;
}
JS:
function strikethrough(){
var ele = document.getElementById("changeText1");
var checkBox = document.getElementById("mycheckbox1");
if (checkBox.checked == true){
ele.style.setProperty("text-decoration", "line-through");}
else {
ele.style.setProperty("text-decoration", "none");
}
}
Рабочий пример: https://codepen.io/alexhbryant/pen/dyYVbjK